OpenRA icon indicating copy to clipboard operation
OpenRA copied to clipboard

Red Alert: Chronosphere-teleport to a mine doesn't damage units

Open Diranus opened this issue 9 years ago • 9 comments

Hello,

if you use the chronosphere to teleport an unit (I tested this with a MCV) on top of a mine, the mine will explode, but the unit won't receive damage.

Diranus avatar Oct 24 '17 18:10 Diranus

This seems like a slight oversight that is pretty simple to fix.

penev92 avatar Nov 09 '17 23:11 penev92

#14327 was closed. Does somebody else want to take this over, or are we going to drop this from the milestone?

pchote avatar Nov 25 '17 00:11 pchote

I'm willing to take it up.

ResourceHog avatar Nov 27 '17 04:11 ResourceHog

While I have personal reasons to not want that fixed in the near future, I can't say "no" to a new contributor that is willing to fix things.

penev92 avatar Nov 27 '17 10:11 penev92

I'm willing to take it up.

👍

abcdefg30 avatar Nov 28 '17 00:11 abcdefg30

@ResourceHog do you still want to work on this?

abcdefg30 avatar Feb 22 '18 11:02 abcdefg30

Hello,

I'll take a look at this if no one volunteers. But, for what I have seen, maybe it's not an easy fix for newcomers, or, at least, for me :D It seems that the position update in ActorMap is being done after the teleport tick, so, when the mine tries to find who to harm after exploding(using the "FindActorsInCircle" method), doesn't find the mobile actor.

xecollons avatar Mar 09 '18 20:03 xecollons

Sure, feel free to continue from where #14327 stopped (or your own idea).

abcdefg30 avatar Mar 09 '18 20:03 abcdefg30

https://github.com/OpenRA/OpenRA/pull/14327 was not the correct fix. It seems that the following is happening for both teleported units and paratroopers:

  • The unit's position is updated (IPositionable.SetPosition)
  • The ActorMap is notified to remove the actor from the old position and add it to the new position the next time Tick runs
  • The position update triggers a INotifyCrushed.OnCrush call and the mine explodes
  • The explosion targets the cell the mine is in, the actor map is used to determine which actors are in this cell
  • Since the actor map has not updated the actor positions yet, the new actor is not affected by the explosion

An easy testcase is adding Delay: 1 to the damage warhead of the mines, which works around this problem.

abcdefg30 avatar May 18 '22 12:05 abcdefg30