-- Star Wars Empire at War: Secrets of a Fallen Empire
-- Lua Script: //Scripts/GameObject/ObjectScript_Constructor.lua
-- Author: Galyana
-- Updated: 6 February, 2026

require("PGStateMachine")
require("PGBase")

function Definitions()
	DebugMessage("%s -- In Definitions", tostring(Script))
	Define_State("State_Init", State_Init);
	ServiceRate = 0.5
end

function State_Init(message)	
	if message == OnUpdate then
		if Object.Get_Build_Pad_Contents() ~= nil then
			Object.Stop()
			Object.Suspend_Locomotor(true)
			Object.Set_Selectable(false)
			Object.Prevent_All_Fire(true)
			Object.Prevent_Opportunity_Fire(true)
			-- Despawning the object allows another constructor unit to be built (exploit)
			-- Needs to be despawned to allow death clone to function
			-- We will now fake deathclone via death_survivors and another lua script
--			Sleep(61)
--			Object.Despawn()
			ScriptExit()
		end
	end	
end