Spring.DisableUnit
Moderator: Moderators
Spring.DisableUnit
Requesting the addition of a (synced) "Spring.DisableUnit(unitID)" function, as well as the Spring.EnableUnit(unitID) and Spring.IsUnitEnabled(unitID) that would come along.
A disabled unit would not be able to execute commands, regardless if they were given manually or automatically. It also shouldn't generate new commands automatically (i.e. it shouldn't get the attack order if an enemy unit is nearby).
It may get new commands manually like an enabled unit would, but it won't execute any.
It could still be interacted with by other units, e.g. attacked, healed, etc, and any Lua commands such as Spring.SetUnitPosition would still take effect.
Upon enabling the unit again, it will do its orders normally.
The closest thing that currently exists is the "paralyze" status, but it doesn't work on some units (e.g. commanders and dragon claw's in BA-like games), comes with an unwanted visual effect and has a mandatory expiry time based on the HP of the unit.
Thoughts?
A disabled unit would not be able to execute commands, regardless if they were given manually or automatically. It also shouldn't generate new commands automatically (i.e. it shouldn't get the attack order if an enemy unit is nearby).
It may get new commands manually like an enabled unit would, but it won't execute any.
It could still be interacted with by other units, e.g. attacked, healed, etc, and any Lua commands such as Spring.SetUnitPosition would still take effect.
Upon enabling the unit again, it will do its orders normally.
The closest thing that currently exists is the "paralyze" status, but it doesn't work on some units (e.g. commanders and dragon claw's in BA-like games), comes with an unwanted visual effect and has a mandatory expiry time based on the HP of the unit.
Thoughts?
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: Spring.DisableUnit
Can't that already be done by saving/reloading the command queue and temporarily denying all commands to the unit via synced gadget:AllowCommand?
Re: Spring.DisableUnit
What about adding paralyse damage to it via Spring.AddUnitDamage ?
Or Spring.MoveCtrl.Enable to pin it?
Or, yes, clearing queue or simply giving it a STOP command every frame?
The unwanted visual effect or paralyse is purely lua gadget no?
And the expiry time can be skipped via Spring.SetUnitHealth(id,hp,{paralyze=0})
Or Spring.MoveCtrl.Enable to pin it?
Or, yes, clearing queue or simply giving it a STOP command every frame?
The unwanted visual effect or paralyse is purely lua gadget no?
And the expiry time can be skipped via Spring.SetUnitHealth(id,hp,{paralyze=0})
Re: Spring.DisableUnit
There are things that are not commands yet are still unit actions. E.g. aiming and firing weapons, for example while FPS-controlled.Can't that already be done by saving/reloading the command queue and temporarily denying all commands to the unit via synced gadget:AllowCommand?
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: Spring.DisableUnit
Orders given in FPS mode don't pass through the widget or gadget callins (they do reach LUS), so typically gadgetry that works by supressing orders must entirely block FPS mode. This is a general problem that wouldn't be (much) helped by having a callout to freeze/unfreeze a unit. Outside of FPS mode, lua already has methods to control normal aiming & firing, but my interpretation of gajops feature request was that he didn't need those.
Re: Spring.DisableUnit
I tried most of these things:
Spring.AddUnitDamage - acts weird as doesn't work for all units in all cases (e.g. sometimes it freezes a BA's ARM commander, and sometimes it doesn't, depending on the commander's team).
Spring.MoveCtrl.Enable - doesn't prevent the unit from doing actions that are in its range (e.g. attacking nearby units, building nearby stuff).
gadget:AllowCommand - seems closest to what I want, but it prevents the unit from gaining any new commands.
Spring.SetUnitHealth(id,hp,{paralyze=0}) - will try on some units I had issues with, but I'm not hopeful :p
Spring.AddUnitDamage - acts weird as doesn't work for all units in all cases (e.g. sometimes it freezes a BA's ARM commander, and sometimes it doesn't, depending on the commander's team).
Spring.MoveCtrl.Enable - doesn't prevent the unit from doing actions that are in its range (e.g. attacking nearby units, building nearby stuff).
gadget:AllowCommand - seems closest to what I want, but it prevents the unit from gaining any new commands.
Spring.SetUnitHealth(id,hp,{paralyze=0}) - will try on some units I had issues with, but I'm not hopeful :p
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: Spring.DisableUnit
Cache the commands you deny while disabled, and give to units as appropriate when they become un-disabled. But it won't show the usual visuals to display cached command queue unless you reimplement them (which is a pain to write but it can be done and look absolutely correct - e.g. the Set Target custom command and Initial Queue widget in BA both do this).gadget:AllowCommand - seems closest to what I want, but it prevents the unit from gaining any new commands.
Last edited by Silentwings on 05 Sep 2014, 12:38, edited 2 times in total.
Re: Spring.DisableUnit
I think that decoupling ability to deactivate units completely from the OTA paralyze mechanic would be a good thing to have, and would be less inelegant than using layered gadgetry as described above to work around the issue.
Spring seems to aim to be a versatile engine, and requiring any game that wants a non-OTA-like paralyze behaviour, or something else that turns units off, to go to such lengths, sounds weird.
Spring seems to aim to be a versatile engine, and requiring any game that wants a non-OTA-like paralyze behaviour, or something else that turns units off, to go to such lengths, sounds weird.
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: Spring.DisableUnit
This may contain everything you need to disable a unit: https://github.com/ZeroK-RTS/Zero-K/blo ... ibutes.lua
Re: Spring.DisableUnit
Scores a big +1 from me.Anarchid wrote:I think that decoupling ability to deactivate units completely from the OTA paralyze mechanic would be a good thing to have, and would be less inelegant than using layered gadgetry as described above to work around the issue.
Spring seems to aim to be a versatile engine, and requiring any game that wants a non-OTA-like paralyze behaviour, or something else that turns units off, to go to such lengths, sounds weird.
Re: Spring.DisableUnit
I'm all in favor of a new Spring.DisableUnit, but in the meanwhile, can I get some info on this:
Is the visual effect something that is present by default, and could be removed (if so, how?)? Or is this something that each game has to add, and in that case, where is it added in BA and ZK?zwzsg wrote:The unwanted visual effect or paralyse is purely lua gadget no?