Skip to content

Commit

Permalink
Made DDM guns not get stuck in each other.
Browse files Browse the repository at this point in the history
  • Loading branch information
GoogleFrog committed Apr 17, 2017
1 parent 24b152b commit 40c1563
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
Binary file modified Objects3d/DDM.s3o
Binary file not shown.
23 changes: 17 additions & 6 deletions scripts/cordoom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ local shell_2 = piece "Shell_2"

-- guns

local cannonAim = piece "cannonAim"
local cannonbase = piece "CannonBase"
local cannon = piece "Cannon"
local flare1 = piece "flare1"
Expand All @@ -22,6 +23,7 @@ local spGetUnitRulesParam = Spring.GetUnitRulesParam
local smokePiece = { shell_1, shell_2, cannonbase, heatray }

--variables
local queryPiece = cannonAim
local heat = false
local on = false
--signals
Expand Down Expand Up @@ -168,22 +170,29 @@ function Close()
Spring.SetUnitArmored(unitID,true)
end

function script.Activate ()
function script.Activate()
StartThread(Open)
end

function script.Deactivate ()
function script.Deactivate()
on = false
StartThread(Close)
end

function script.Create()
on = true
StartThread(SmokeUnit, smokePiece)
end

local aimFromSet = {cannonbase, heatraybase}
local aimFromSet = {cannonAim, heatraybase}

local function AimingDone()
queryPiece = flare1
Sleep(500)
queryPiece = cannonAim
end

function script.AimFromWeapon(num)
function script.AimFromWeapon(num)
return aimFromSet[num]
end

Expand All @@ -201,7 +210,9 @@ function script.AimWeapon(num, heading, pitch)
Turn(cannonbase, x_axis, -pitch, mainPitch)
WaitForTurn (shellbase, y_axis)
WaitForTurn (cannonbase, x_axis)


StartThread(AimingDone)

return (spGetUnitRulesParam(unitID, "lowpower") == 0) --checks for sufficient energy in grid
elseif num == 2 then
Signal(aim2)
Expand All @@ -219,7 +230,7 @@ end

function script.QueryWeapon(num)
if num == 1 then
return flare1
return queryPiece
elseif num == 2 then
if heat then
return flare2
Expand Down

0 comments on commit 40c1563

Please sign in to comment.