ZeroK-RTS / Zero-K

Open source RTS game running on the Spring/Recoil engine
https://zero-k.info
GNU General Public License v2.0
691 stars 207 forks source link

Add patrol, fight, and move commands to structures that morph into mobiles #3558

Open dvr333 opened 5 years ago

dvr333 commented 5 years ago

When morphing into a mobile unit, it's kindof annoying that you can't queue move commands until after the unit has finished morphing. Ideally, when the morph order is underway, the command card would change to the to-be-morphed unit to allow for order queuing during construction, just like with factory units under construction. If the morph is cancelled, then the commands would just get cancelled as well.

GoogleFrog commented 5 years ago

I think it would be sufficient to give static units move, fight, and patrol if they are morphing into a mobile unit. Many commands check their validity on AllowCommand so would also need to check whether a structure has the command on CommandFallback. It may be best to create some fake queuing commands, especially in the case of engine commands.

GoogleFrog commented 5 years ago

See https://github.com/ZeroK-RTS/Zero-K/commit/8204e486e979c9b8c114dc5b7ea5afe20b68090f

dvr333 commented 5 years ago

Cool, if that exposes the Move command when morphing (I'm not super familiar with how unitdefs are interpreted), then that's a huge chunk of the way there. Being able to Patrol/Fight is nice, but to me the priority thing is to have some way to get the Sparrow moving the moment it's ready.

Okay, tested it out. It certainly works. Shame the button shows when unmorphed and not morphing, I suppose that's an engine limitation.

GoogleFrog commented 5 years ago

Is it a shame? It isn't an engine limitation. I was midway through implementing adding/removal when I lost any sense of the purpose of what I was doing. How can a move command for the radar tower hurt people?

A permanent move command seems good.

GoogleFrog commented 5 years ago

The move command was so easy to add because it is a lua command. Patrol and Fight are built-in commands and likely have sanity checks that prevent them automatically appearing for static units.

dvr333 commented 5 years ago

That makes sense.