Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local base, turret, barrel1, firepoint1, dirt = piece('base', 'turret', 'barrel1', 'firepoint1', 'dirt')
- local SIG_AIM = {}
- -- state variables
- isMoving = "isMoving"
- function script.Create()
- end
- function setSFXoccupy(setSFXoccupy_argument)
- local terrainType = setSFXocupy_argument
- if terrainType == 2 then
- Move(base, y_axis, -0.85, 50)
- local upright = true
- else
- Move(base, y_axis, 0, 50)
- local upright = false
- end
- if terrainType == 4 then
- Move(base, y_axis, 0, 50)
- local upright = false
- else
- Move(base, y_axis, -0.85, 50)
- local upright = true
- end
- end
- function script.StartMoving()
- isMoving = true
- StartThread(thrust)
- end
- function script.StopMoving()
- isMoving = false
- end
- function thrust()
- while isMoving do
- EmitSfx (dirt, 1025)
- Sleep(400)
- end
- end
- --local RESTORE_DELAY = 2 * 1000 * Spring.GetUnitWeaponState(unitID, 0, 'reloadTime')
- local function RestoreAfterDelay()
- Sleep(2000)
- Turn(turret, y_axis, 0, 0.5)
- Turn(barrel1, x_axis, 0, 0.25)
- end
- function script.AimWeapon1(heading, pitch)
- Signal(SIG_AIM)
- SetSignalMask(SIG_AIM)
- Turn(turret, y_axis, heading, 25)
- Turn(barrel1, x_axis, pitch, 25)
- WaitForTurn(turret, y_axis)
- WaitForTurn(barrel1, x_axis)
- StartThread(RestoreAfterDelay)
- return true
- end
- function script.AimFromWeapon1()
- return turret
- end
- function script.QueryWeapon1()
- return firepoint1
- end
- function script.FireWeapon1()
- EmitSfx (firepoint1, 1024)
- end
- local random = math.random
- function SmokeUnit(smokePieces)
- local n = #smokePieces
- while (GetUnitValue(COB.BUILD_PERCENT_LEFT) ~= 0) do
- Sleep(1000)
- end
- while true do
- local health = GetUnitValue(COB.HEALTH)
- if (health <= 66) then -- only smoke if less then 2/3rd health left
- EmitSfx(smokePieces[random(1,n)], 1026)
- end
- Sleep(20*health + 200)
- end
- end
- function script.Killed()
- Explode(barrel1, SFX.EXPLODE_ON_HIT)
- Explode(turret, SFX.EXPLODE_ON_HIT)
- return 1 -- spawn ARMSTUMP_DEAD corpse / This is the equivalent of corpsetype = 1; in bos
- end
Advertisement
Add Comment
Please, Sign In to add comment