Files
SoaFE/DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_GC_STEALTH_REVEAL_300.LUA
2026-02-28 14:00:45 -06:00

48 lines
1.3 KiB
Lua

-- Star Wars Empire at War: Secrets of a Fallen Empire
-- Lua Script: //Scripts/GameObject/ObjectScript_GC_Stealth_Reveal_300.lua
-- Author: Galyana
-- Updated: 6 February, 2026
-- LUA fix for generic stealth detecting units
-- Will need to be removed once petro patches this bug
require("PGStateMachine")
function Definitions()
DebugMessage("%s -- In definitions", tostring(Script))
ServiceRate = 1
Define_State("State_Init", State_Init);
stealth_reveal_range = 300
stealth_ability = "STEALTH"
end
function State_Init(message)
if message == OnEnter then
-- we only want this script to run during GC tactical battles
if Is_Campaign_Game() ~= true then
ScriptExit()
end
-- prevent this from doing anything in galactic mode
if Get_Game_Mode() == "Galactic" then
ScriptExit()
end
Register_Prox(Object, Unit_Prox, stealth_reveal_range)
end
end
-- If a stealthed enemy enters the prox, disable their stealth ability
function Unit_Prox(self_obj, trigger_obj)
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
return
end
if trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
if trigger_obj.Is_Ability_Active(stealth_ability) then
trigger_obj.Cancel_Ability(stealth_ability)
end
end
end