New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update repairer consumption when a unit dies #660
Conversation
c9628dd
to
49813e0
Compare
@@ -1211,8 +1226,8 @@ Unit = Class(moho.unit_methods) { | |||
self:ForkThread(self.PlayAnimationThread, 'AnimationDeath') | |||
self.DisallowCollisions = true | |||
end | |||
|
|||
self:DoUnitCallbacks( 'OnKilled' ) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please perform style changes like this in a seperate commit.
You can't control unit order queues from lua, so unless you want to call Overall I don't think this patch adds much except for additional mud to the pile that is repairing/assisting/consumption. I prefer a full rework of these odd algorithms that are in place. The iteration of nearby ally units with |
I dont much like it either, but its a fairly major resource waste bug, and aside from being ugly this does fix it. If someone can find how to turn off the progress bar we are golden |
What if we sent the engi a move command to its current location? |
You would need to issue a clearcommand first, which kills the order queue entirely -- since you can't introspect it within the sim, you can't reliably reconstruct it, unfortunately. |
9ddfdee
to
866b38d
Compare
Well, that was easier to get working than I thought. Thanks Sheeo, Chris, for putting me onto IssueClearCommands() :D |
This is probably the only way to actually handle this from lua: immediately destroy the unit and spawn an identical one with zero health in its place (which just does the whole blowing-up animation and so on). There is likely a meaningful performance cost associated with doing this. I really don't think this bug is worth fixing for now. |
We could do it only for shields, as they are the most significant case (long death animation, likely to be being repaired). |
866b38d
to
debc162
Compare
OK so, in this state we sit at: The buildbeam turns off As you can see, it's possible to harvest the command table for the unit. However, I don't see any way to re-issue it in an identical state. We can issue individual commands, but not the queue for some reason. If we could, we could clear the queue then immediately re-issue it, and trust the engine to recognise the unit at the top of the list is dead now. |
debc162
to
97bf815
Compare
Needs rebase targeting debelop |
Addresses #642
This fix is ready, but not perfect. The build bar state persists until the unit's self:Destroy() is called, so if anyone has an idea how to do that, please help out. @Crotalus?
This whole situation is a mess. For some reason, calling self:Destroy tells any repairing/capturing/assisting units to go to idle etc, or to the next thing on the queue, but self:Kill() does not. It simply links you to OnKilled in the lua, and appears to do engine checks for the unit's own consumption/building state, and for units in the guard state (Assisters), but ignores repairs.
However, since in the lua we sometimes hook into OnKilled with a long-lasting explosion, the delay between OnKilled and the final self:Destroy at the end of the sequence can be lengthy in some cases (UEF Quantum Gate, for example), with the Engineer continuing to repair and waste resources right to the end.