Initial commit
This commit is contained in:
40
DATA/SCRIPTS/GAMEOBJECT/SECONDARYMERCHANTDOCK_CAPTURABLE.LUA
Normal file
40
DATA/SCRIPTS/GAMEOBJECT/SECONDARYMERCHANTDOCK_CAPTURABLE.LUA
Normal file
@@ -0,0 +1,40 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/SecondaryMerchantDock_Capturable.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 8 February, 2026
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
-- Once this object has fully transitioned to a playable side it spits out units for its owner
|
||||
|
||||
function Definitions()
|
||||
Define_State("State_Waiting_For_Control", State_Waiting_For_Control);
|
||||
Define_State("State_Controlled", State_Controlled);
|
||||
end
|
||||
|
||||
function State_Waiting_For_Control(message)
|
||||
if message == OnEnter then
|
||||
Object.Set_Garrison_Spawn(false)
|
||||
elseif message == OnUpdate then
|
||||
faction = Object.Get_Owner().Get_Faction_Name()
|
||||
if faction == "REBEL" or faction == "EMPIRE" or faction == "UNDERWORLD" or faction == "HUTTS" or faction == "PIRATES" then
|
||||
Set_Next_State("State_Controlled")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Once captured, lock the structure for X seconds to allow garrison to spawn
|
||||
function State_Controlled(message)
|
||||
if message == OnEnter then
|
||||
Object.Set_Garrison_Spawn(true)
|
||||
Object.Disable_Capture(true)
|
||||
Sleep(20)
|
||||
Object.Disable_Capture(false)
|
||||
-- Loop back to initial state if control is lost
|
||||
elseif message == OnUpdate then
|
||||
faction = Object.Get_Owner().Get_Faction_Name()
|
||||
if faction == "NEUTRAL" then
|
||||
Set_Next_State("State_Waiting_For_Control")
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user