add Spring.SetUnitStunned(unitID, bool) which, if enabled, makes the unit behave the same as if it had >100% EMP damage regardless of its actual EMP state.
make sure Spring.GetUnitStunned takes the new stun state into account.
initially it's probably best if wupget:UnitStunned and wupget:UnitUnstunned still only work off EMP going across the 100% threshold, since a game can easily trigger it on its own for the new callout via
local originalSetStun = Spring.SetUnitStunned
function Spring.SetUnitStunned(unitID, stun)
originalSetStun(unitID, stun)
local unitDefID, teamID = Spring.GetUnitDefID(unitID), Spring.GetUnitTeam(unitID)
if stun then
Script.LuaUI.UnitStunned(unitID, unitDefID, teamID)
Script.LuaRules.UnitStunned(unitID, unitDefID, teamID)
else
Script.LuaUI.UnitUnstunned(unitID, unitDefID, teamID)
Script.LuaRules.UnitUnstunned(unitID, unitDefID, teamID)
end
end
but it's harder to filter it out the other way around.
Spring.SetUnitStunned(unitID, bool)
which, if enabled, makes the unit behave the same as if it had >100% EMP damage regardless of its actual EMP state.Spring.GetUnitStunned
takes the new stun state into account.wupget:UnitStunned
andwupget:UnitUnstunned
still only work off EMP going across the 100% threshold, since a game can easily trigger it on its own for the new callout viabut it's harder to filter it out the other way around.