Teardown

Teardown

TSUNAMI MOD ( NEOTASTIC YT)
How to make the tsunami WAY more destructive
I made the tsunami do much more damage and also improved a few other things. It's very complicated and idk if I explained it well so sorry if I didn’t.
< >
Showing 1-9 of 9 comments
ilfal 30 Jul @ 12:02pm 
DISCLAIMER:

This can get VERY LAGGY so a debris cleaner is advised.

This only works on windows (I’m using windows 10).

Before using the built in screen recorder, change 400 to 200 on line 200 (the line that says “number of holes”).

I changed the receding key to “T” so to make the water recede press t again.

Also I’m not a coder so sorry if there’s any bugs and let me know if you run into any issues.
ilfal 30 Jul @ 12:02pm 
TL;DR:

Step 1: Copy mod and find mod file

Step 2: Insert new code

Step 3: Make wave spawnable

Step 4: Wave options
ilfal 30 Jul @ 12:03pm 
STEP 1: Copy mod and find mod file

On the main screen, click play then click “Mod manager.” On the mod manager, scroll to the tsunami mod and click on it. Then, click the “Make local copy” button to make a local copy of the mod.

Next, go to the file manager on your computer (or press windows key + e) and insert this line into the top bar:

Teardown\mods\[noupload] Tsunami Wave Copy\main\scripts

This should take you to the scripts folder, where you will edit the “floodwater” script.
ilfal 30 Jul @ 12:05pm 
STEP 2: Insert new code

Open the script with notepad; you can do this by right-clicking floodwater, clicking “open with,” click “Choose another app,” then clicking Notepad. You could also open with Visual Studio Code but you need to have to downloaded first.

Once the code is open, select the entire code and replace it with this (2 parts):
Last edited by ilfal; 30 Jul @ 12:08pm
ilfal 30 Jul @ 12:07pm 
function init()
BoxBody=FindBody(tsunami_spawner)
--values for settings

--wavespeed=10
--particle_intensity=15
--holescale=1
--pushstrength=1

wavespeed=GetFloat("savegame.mod.wave_speed")
particle_intensity=GetFloat("savegame.mod.particle_intensity")
holescale=GetFloat("savegame.mod.hole_damage")
pushstrength=GetFloat("savegame.mod.push_damage")
wave_pause=false

Xspeed=0
Xtimer=0.1

pausetimer=1






floodsound = LoadLoop("MOD/main/tsunami/snd/wave.ogg")
FloodBody=FindBody(floodbody)

if HasTag(FloodBody,"north") then
cor=-1
else
cor=1
end

northpoint=VecAdd(GetBodyTransform(BoxBody).pos, Vec(-10,0,-10))
dir_global=QuatRotateVec(QuatLookAt(GetBodyTransform(BoxBody).pos, northpoint), Vec(0, 0, -1))
dir=TransformToLocalVec(GetBodyTransform(BoxBody), dir_global)

dirX=dir[1]
dirZ=dir[3]
dir_equalizer=dirX/dirZ

water1={}
water2={}
water3={}
water4={}
water5={}
water6={}
water7={}
water8={}
water9={}
water10={}
water11={}
water12={}
water13={}
water14={}
water142={}
water15={}
water16={}
water17={}
water18={}
water19={}
water20={}
water21={}
water22={}
water23={}
water24={}
water25={}
water26={}
water27={}
water28={}
water29={}
water30={}
water31={}
water32={}


waterlight1=FindLight("waterlight1")
waterlight2=FindLight("waterlight2")
waterlight3=FindLight("waterlight3")
waterlight4=FindLight("waterlight4")
waterlight5=FindLight("waterlight5")
waterlight6=FindLight("waterlight6")
waterlight7=FindLight("waterlight7")
waterlight8=FindLight("waterlight8")
waterlight9=FindLight("waterlight9")
waterlight10=FindLight("waterlight10")
waterlight11=FindLight("waterlight11")
waterlight12=FindLight("waterlight12")
waterlight13=FindLight("waterlight13")
waterlight14=FindLight("waterlight14")
waterlight142=FindLight("waterlight142")
waterlight15=FindLight("waterlight15")
waterlight16=FindLight("waterlight16")
waterlight17=FindLight("waterlight17")
waterlight18=FindLight("waterlight18")
waterlight19=FindLight("waterlight19")
waterlight20=FindLight("waterlight20")
waterlight21=FindLight("waterlight21")
waterlight22=FindLight("waterlight22")
waterlight23=FindLight("waterlight23")
waterlight24=FindLight("waterlight24")
waterlight25=FindLight("waterlight25")
waterlight26=FindLight("waterlight26")
waterlight27=FindLight("waterlight27")
waterlight28=FindLight("waterlight28")
waterlight29=FindLight("waterlight29")
waterlight30=FindLight("waterlight30")
waterlight31=FindLight("waterlight31")
waterlight32=FindLight("waterlight32")

watertime=0
watergen=true

if watergen==true then
SetBodyDynamic(FloodBody,true)
end

end

function rnd(mi, ma)
return math.random(1000)/1000*(ma-mi) + mi
end

function tick()

--if InputPressed("g") and wave_pause==false and pausetimer>0.5 then
--wave_pause=true
--pausetimer=0
--SetBodyDynamic(FloodBody,false)
--end

--if InputPressed("g") and pausetimer>0.5 then
--wave_pause=false
--pausetimer=0
--SetBodyDynamic(FloodBody,true)
--end

if InputPressed("t") then
recede = false
end
if InputPressed("t") and Xtimer>0.1 and Xspeed==0 and recede==false then
Xspeed=3
recede = true
Xtimer=0
end
--if InputPressed("t") and Xtimer>0.1 and Xspeed==10 then
--Xspeed=0
--Xtimer=0
--recede = true
--end


end


function update()

Xtimer=Xtimer+1

if wave_pause==false then
watertime=watertime+1
end

pausetimer=pausetimer+1

--DebugWatch("watertime",watertime)

FloodTrans=GetBodyTransform(FloodBody)
WaveSpeedReal=GetBodyVelocity(FloodBody)
---PLAYER POS

ppos=TransformToParentVec(FloodTrans,VecSub(FloodTrans.pos,GetPlayerTransform().pos))
--DebugCross(FloodTrans.pos)
pposX=ppos[1] --dir sideways

pposY=ppos[2] --height above wave

pposZ=ppos[3] --distance to wave


BasePos=TransformToParentPoint(FloodTrans, Vec(cor*pposX, 0, 7.5))

PlayerDist=VecLength(VecSub(BasePos,GetPlayerTransform().pos))
ParticleBasePos=TransformToParentPoint(FloodTrans, Vec(cor*pposX+rnd(-75,75), rnd(-10,0), 3))
ParticleWidePos=TransformToParentPoint(FloodTrans, Vec(cor*pposX+rnd(-200,200), rnd(-10,0), 3))

ParticleBasePos2=TransformToParentPoint(FloodTrans, Vec(cor*pposX,0, 10*cor))

---SOUND
ShakeCamera(1-PlayerDist*0.02)
PlayLoop(floodsound, BasePos, (100-PlayerDist*0.5))


--DAMAGE

--hole damage
for i=1, 1 do
HoleVecMain=Vec(cor*pposX+rnd(-75,75), rnd(-2,2), 3)
for i=1, 400 do --Number of holes
MakeHole(TransformToParentPoint(FloodTrans, VecAdd(HoleVecMain,Vec(rnd(-1000,1000),-25+(((rnd(0, 1)^2.15))*(2.5-(-25))),rnd(-2.5,2.5)))), 10, 10, 0, false)
end
end
--push DAMAGE
--get all bodies, for every n body get distance to basepoint, apply impulse equal to wave vec

--NORTH/SOUTH
if dirX>=0 and dir_equalizer<=0 or dirX<0 and dir_equalizer<=0 then
geodir=1
end
--WEST/EAST
if dirZ>=0 and dir_equalizer>0 or dirZ<0 and dir_equalizer>0 then
geodir=2
end

if geodir == 1 then
HitBodies = QueryAabbBodies(VecAdd(BasePos, Vec(-30,-20,-1000)), VecAdd(BasePos, Vec(30,5,1000)))
end

if geodir == 2 then
HitBodies = QueryAabbBodies(VecAdd(BasePos, Vec(-1000,-20,-30)), VecAdd(BasePos, Vec(1000,5,30)))
end

for _, HitBody in ipairs(HitBodies) do
if IsBodyDynamic(HitBody, true) and HasTag(HitBody, "floodbody") == false then
-- so much W
ApplyBodyImpulse(HitBody, GetBodyTransform(HitBody).pos,
Vec(WaveSpeedReal[1] * pushstrength * GetBodyMass(HitBody) * 0.004, 1 * pushstrength * GetBodyMass(HitBody) * 0.004, WaveSpeedReal[3] * pushstrength * GetBodyMass(HitBody) * 0.004))
end
end




---PARTICLES

for i=1, 5 do

--water wide
ParticleReset()
ParticleTile(5)
ParticleRotation(rnd(2,3), 0.0, "easeout")
ParticleType("plain")
ParticleCollide(0)
ParticleRadius(5, 10)
ParticleDrag(0)
ParticleEmissive(0, 0)
ParticleColor(.9,.9,1)
ParticleGravity(rnd(-5,-8))
ParticleAlpha("easein",1, 0)
SpawnParticle(ParticleWidePos, Vec(rnd(1.5*WaveSpeedReal[1],2*WaveSpeedReal[1]),rnd(-0,5),rnd(1.5*WaveSpeedReal[3],2*WaveSpeedReal[3])), 3)
end

for i=1, 5 do

--water wide
ParticleReset()
ParticleTile(0)
ParticleRotation(rnd(2,3), 0.0, "easeout")
ParticleType("plain")
ParticleCollide(0)
ParticleRadius(5, 10)
ParticleDrag(0)
ParticleEmissive(0, 0)
ParticleColor(.9,.9,1)
ParticleGravity(rnd(-5,-8))
ParticleAlpha("easein",1, 0)
SpawnParticle(ParticleWidePos, Vec(rnd(1.5*WaveSpeedReal[1],2*WaveSpeedReal[1]),rnd(-0,5),rnd(1.5*WaveSpeedReal[3],2*WaveSpeedReal[3])), 3)
end

------CENTRAL WAVE
for i=1, particle_intensity do

--water splash
ParticleReset()
ParticleTile(5)
ParticleRotation(rnd(2,3), 0.0, "easeout")
ParticleType("plain")
ParticleCollide(0)
ParticleRadius(5, 7)
ParticleDrag(rnd(0.05,0.15))
ParticleEmissive(0, 0)
ParticleColor(.9,.9,1)
ParticleGravity(rnd(-5,-8))
ParticleAlpha("easein", 1, 0)
--ParticleSticky(0.0)
SpawnParticle(ParticleBasePos, Vec(rnd(1.5*WaveSpeedReal[1],2*WaveSpeedReal[1]),rnd(-0,7),rnd(1.5*WaveSpeedReal[3],2*WaveSpeedReal[3])), 3)
end

for i=1, particle_intensity do

--water splash
ParticleReset()
ParticleTile(0)
ParticleRotation(rnd(2,3), 0.0, "easeout")
ParticleType("plain")
ParticleCollide(0)
ParticleRadius(5, 7)
ParticleDrag(rnd(0.05,0.15))
ParticleEmissive(0, 0)
ParticleColor(.9,.9,1)
ParticleGravity(rnd(-5,-8))
ParticleAlpha("easein", 0.5, 0)
--ParticleSticky(0.0)
SpawnParticle(VecAdd(ParticleBasePos,Vec(rnd(-5,5),rnd(-5,5),rnd(-5,5))), Vec(rnd(1.5*WaveSpeedReal[1],2*WaveSpeedReal[1]),rnd(-0,5),rnd(1.5*WaveSpeedReal[3],2*WaveSpeedReal[3])), 3)
end

for i=1, particle_intensity*2 do

--water bubbles
ParticleReset()
ParticleTile(8)
ParticleType("plain")
ParticleCollide(0)
ParticleRadius(5, 7)
ParticleDrag(rnd(0.05,0.15))
ParticleRotation(rnd(2,3), 0.0, "easeout")
ParticleEmissive(0, 0)
ParticleColor(.9,.9,1)
ParticleGravity(rnd(-5,-8))
ParticleAlpha("easein",1, 0)
--ParticleSticky(0.0)
SpawnParticle(ParticleBasePos, Vec(rnd(1.75*WaveSpeedReal[1],2.3*WaveSpeedReal[1]),rnd(0,10),rnd(1.75*WaveSpeedReal[3],2.3*WaveSpeedReal[3])), 3)
end




if InputPressed("u") and wave_pause==false and pausetimer>0.5 then
wave_pause=true
pausetimer=0
SetBodyDynamic(FloodBody,false)
end

if InputPressed("u") and pausetimer>0.5 then
wave_pause=false
pausetimer=0
SetBodyDynamic(FloodBody,true)
end


if wave_pause==false then
watertime=watertime+1
end

if watertime>(18000000/wavespeed) then
SetBodyDynamic(FloodBody,false)
watergen=false
end






if watergen==true then

SetBodyVelocity(FloodBody,TransformToParentVec(FloodTrans,Vec(0,0.16-Xspeed,wavespeed)))
--Delete(FloodBody)
ilfal 30 Jul @ 12:08pm 
WaterTrans1=GetLightTransform(waterlight1)
WaterTrans2=GetLightTransform(waterlight2)
WaterTrans3=GetLightTransform(waterlight3)
WaterTrans4=GetLightTransform(waterlight4)
WaterTrans5=GetLightTransform(waterlight5)
WaterTrans6=GetLightTransform(waterlight6)
WaterTrans7=GetLightTransform(waterlight7)
WaterTrans8=GetLightTransform(waterlight8)
WaterTrans9=GetLightTransform(waterlight9)
WaterTrans10=GetLightTransform(waterlight10)
WaterTrans11=GetLightTransform(waterlight11)
WaterTrans12=GetLightTransform(waterlight12)
WaterTrans13=GetLightTransform(waterlight13)
WaterTrans14=GetLightTransform(waterlight14)
WaterTrans142=GetLightTransform(waterlight142)
WaterTrans15=GetLightTransform(waterlight15)
WaterTrans16=GetLightTransform(waterlight16)
WaterTrans17=GetLightTransform(waterlight17)
WaterTrans18=GetLightTransform(waterlight18)
WaterTrans19=GetLightTransform(waterlight19)
WaterTrans20=GetLightTransform(waterlight20)
WaterTrans21=GetLightTransform(waterlight21)
WaterTrans22=GetLightTransform(waterlight22)
WaterTrans23=GetLightTransform(waterlight23)
WaterTrans24=GetLightTransform(waterlight24)
WaterTrans25=GetLightTransform(waterlight25)
WaterTrans26=GetLightTransform(waterlight26)
WaterTrans27=GetLightTransform(waterlight27)
WaterTrans28=GetLightTransform(waterlight28)
WaterTrans29=GetLightTransform(waterlight29)
WaterTrans30=GetLightTransform(waterlight30)
WaterTrans31=GetLightTransform(waterlight31)
WaterTrans32=GetLightTransform(waterlight32)






Delete(water1[1])
Delete(water2[1])
Delete(water3[1])
Delete(water4[1])
Delete(water5[1])

water1 = Spawn("<water pos='0.0 0.0 0.0' size='100 40' depth='0' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans1)
water2 = Spawn("<water pos='0.0 0.0 0.0' size='100 10' depth='1' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans2)
water3 = Spawn("<water pos='0.0 0.0 0.0' size='100 20' depth='1' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans3)
water4 = Spawn("<water pos='0.0 0.0 0.0' size='1000 40' depth='30' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans4)
water5 = Spawn("<water pos='0.0 0.0 0.0' size='1000 10000' depth='20' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans5)

---front1
Delete(water6[1])
Delete(water7[1])
Delete(water8[1])
Delete(water9[1])
Delete(water10[1])
Delete(water11[1])
Delete(water12[1])
Delete(water13[1])
Delete(water14[1])
Delete(water142[1])

water6 = Spawn("<water pos='0.0 0.0 0.0' size='100 40' depth='0' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans6)
water7 = Spawn("<water pos='0.0 0.0 0.0' size='100 40' depth='0' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans7)
water8 = Spawn("<water pos='0.0 0.0 0.0' size='100 40' depth='0' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans8)
water9 = Spawn("<water pos='0.0 0.0 0.0' size='100 40' depth='0' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans9)
water10 = Spawn("<water pos='0.0 0.0 0.0' size='100 40' depth='0' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans10)
water11 = Spawn("<water pos='0.0 0.0 0.0' size='100 40' depth='0' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans11)
water12 = Spawn("<water pos='0.0 0.0 0.0' size='100 40' depth='0' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans12)
water13 = Spawn("<water pos='0.0 0.0 0.0' size='100 40' depth='0' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans13)
water14 = Spawn("<water pos='0.0 0.0 0.0' size='100 40' depth='0' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans14)
water142 = Spawn("<water pos='0.0 0.0 0.0' size='100 40' depth='0' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans142)
---front2

Delete(water15[1])
Delete(water16[1])
Delete(water17[1])
Delete(water18[1])
Delete(water19[1])
Delete(water20[1])
Delete(water21[1])
Delete(water22[1])
Delete(water23[1])

water15 = Spawn("<water pos='0.0 0.0 0.0' size='100 10' depth='1' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans15)
water16 = Spawn("<water pos='0.0 0.0 0.0' size='100 10' depth='1' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans16)
water17 = Spawn("<water pos='0.0 0.0 0.0' size='100 10' depth='1' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans17)
water18 = Spawn("<water pos='0.0 0.0 0.0' size='100 10' depth='1' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans18)
water19 = Spawn("<water pos='0.0 0.0 0.0' size='100 10' depth='1' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans19)
water20 = Spawn("<water pos='0.0 0.0 0.0' size='100 10' depth='1' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans20)
water21 = Spawn("<water pos='0.0 0.0 0.0' size='100 10' depth='1' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans21)
water22 = Spawn("<water pos='0.0 0.0 0.0' size='100 10' depth='1' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans22)
water23 = Spawn("<water pos='0.0 0.0 0.0' size='100 10' depth='1' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans23)


---front3

Delete(water24[1])
Delete(water25[1])
Delete(water26[1])
Delete(water27[1])
Delete(water28[1])
Delete(water29[1])
Delete(water30[1])
Delete(water31[1])
Delete(water32[1])

water24 = Spawn("<water pos='0.0 0.0 0.0' size='100 20' depth='1' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans24)
water25 = Spawn("<water pos='0.0 0.0 0.0' size='100 20' depth='1' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans25)
water26 = Spawn("<water pos='0.0 0.0 0.0' size='100 20' depth='1' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans26)
water27 = Spawn("<water pos='0.0 0.0 0.0' size='100 20' depth='1' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans27)
water28 = Spawn("<water pos='0.0 0.0 0.0' size='100 20' depth='1' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans28)
water29 = Spawn("<water pos='0.0 0.0 0.0' size='100 20' depth='1' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans29)
water30 = Spawn("<water pos='0.0 0.0 0.0' size='100 20' depth='1' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans30)
water31 = Spawn("<water pos='0.0 0.0 0.0' size='100 20' depth='1' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans31)
water32 = Spawn("<water pos='0.0 0.0 0.0' size='100 20' depth='1' wave='1.5' ripple='0.6' motion='0.5' foam='10' color='0.0 0.01 0.03' visibility='2' />",WaterTrans32)

end


end
ilfal 30 Jul @ 12:09pm 
Finally, save the code by pressing ctrl+s or by clicking file then pressing save.
ilfal 30 Jul @ 12:10pm 
STEP 3: Make tsunami spawnable

After closing the script, go back until you see the “spawn” document. Then, insert this:

main/tsunami/spawner.xml : [mod category]/[name]

(You can choose any name for the mod category and name)
Last edited by ilfal; 30 Jul @ 12:10pm
ilfal 30 Jul @ 12:11pm 
STEP 4: Wave options

Lastly, go back into the teardown mod manager and select the tsunami mod copy. After that, click options, then set the wave speed to 30, ‘hole’ damage size to 10, and push damage strength to 4.

Now the tsunami should do much more realistic damage.
Last edited by ilfal; 30 Jul @ 12:13pm
< >
Showing 1-9 of 9 comments
Per page: 1530 50