switchBrokenMaterial
Definition
-- @/lua/vehicle/material.lua:33
local function switchBrokenMaterial(beam)
for msc, g in pairs(beam.deformSwitches) do
--log('D', "material.switchBrokenMaterial", "mesh broke: "..g.mesh.. " with deformGroup " .. g.deformGroup)
props.disablePropsInDeformGroup(g.deformGroup)
local dm = deformMeshes[g.deformGroup]
if dm then --if there is a mesh assigned to this deformGroup
if dm.deformSound and dm.deformSound ~= "" and not brokenSwitches[msc] then --check if the mesh has a deform sound
--sounds.playSoundOnceAtNode(dm.deformSound, beam.id1, dm.deformVolume or 1) --play the deform sound
sounds.playSoundOnceFollowNode(dm.deformSound, beam.id1, (dm.deformVolume or 1) * 0.5)
--print ((dm.deformVolume or 1) * 0.5)
beamstate.addDamage(500)
end
end
switchMaterial(msc, g.dmgMat)
brokenSwitches[msc] = true
end
end
Callers
@/lua/vehicle/beamstate.lua
local function breakMaterial(beam)
material.switchBrokenMaterial(beam)
if b.deformSwitches then
material.switchBrokenMaterial(b)
end