Skip to content

Commit

Permalink
Roaches and Ticks are now visible when ejected from a transport in mi…
Browse files Browse the repository at this point in the history
…d air.
  • Loading branch information
GoogleFrog committed May 5, 2015
1 parent be94918 commit 2407a5a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
15 changes: 8 additions & 7 deletions scripts/armtick.lua
Expand Up @@ -18,6 +18,7 @@ local digger = piece 'digger'
--linear constant 65536

include "constants.lua"
include 'reliableStartMoving.lua'

--cob values
local cloaked = COB.CLOAKED
Expand Down Expand Up @@ -212,12 +213,7 @@ local function UnBurrow()
StartThread( Walk )
end


function script.Create()
StartThread(SmokeUnit, smokePiece)
end

function script.StartMoving()
function StartMoving()
Signal( SIG_BURROW )
if burrowed then
StartThread( UnBurrow )
Expand All @@ -226,10 +222,15 @@ function script.StartMoving()
end
end

function script.StopMoving()
function StopMoving()
StartThread( Burrow )
end

function script.Create()
StartThread(SmokeUnit, smokePiece)
StartThread(StartStopMovingControl, StartMoving, StopMoving, nil, true)
end

function script.Killed(recentDamage, maxHealth)
Explode(base, sfxNone)
Explode(head, sfxFall, sfxFire, sfxSmoke)
Expand Down
14 changes: 8 additions & 6 deletions scripts/corroach.lua
Expand Up @@ -26,6 +26,7 @@ local rb_foot = piece "legrrshin"

--constants
include "constants.lua"
include 'reliableStartMoving.lua'

local PI = math.pi
local sa = math.rad(20)
Expand Down Expand Up @@ -168,11 +169,7 @@ local function Talk()
Spring.Echo("Hello World! ... Directive: Kill all humans")
end

function script.Create()
StartThread(SmokeUnit, smokePiece)
end

function script.StartMoving()
function StartMoving()
Signal( SIG_BURROW )
if burrowed then
StartThread( UnBurrow )
Expand All @@ -182,10 +179,15 @@ function script.StartMoving()
--StartThread( Talk )
end

function script.StopMoving()
function StopMoving()
StartThread( Burrow )
end

function script.Create()
StartThread(SmokeUnit, smokePiece)
StartThread(StartStopMovingControl, StartMoving, StopMoving, nil, true)
end

function script.Killed(recentDamage, maxHealth)
--Spring.Echo("I am ded")
Explode( lf_leg, SFX.EXPLODE )
Expand Down
7 changes: 6 additions & 1 deletion scripts/reliableStartMoving.lua
Expand Up @@ -4,7 +4,7 @@ local spGetGroundHeight = Spring.GetGroundHeight
local spGetUnitVelocity = Spring.GetUnitVelocity
local spGetUnitPosition = Spring.GetUnitPosition

function StartStopMovingControl(startFunc, stopFunc, thresholdSpeed)
function StartStopMovingControl(startFunc, stopFunc, thresholdSpeed, fallingCountsAsMoving)
thresholdSpeed = thresholdSpeed or 0.05
local x,y,z, height, speed
local moving = false
Expand All @@ -29,6 +29,11 @@ function StartStopMovingControl(startFunc, stopFunc, thresholdSpeed)
startFunc()
end
end
elseif fallingCountsAsMoving then
if not moving then
moving = true
startFunc()
end
end
Sleep(60)
end
Expand Down

0 comments on commit 2407a5a

Please sign in to comment.