Skip to content
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

Gremlins don't die when their owner dies under certain circumstances #367

Open
robojumper opened this issue Dec 28, 2018 · 0 comments · May be fixed by #1362
Open

Gremlins don't die when their owner dies under certain circumstances #367

robojumper opened this issue Dec 28, 2018 · 0 comments · May be fixed by #1362
Milestone

Comments

@robojumper
Copy link
Member

robojumper commented Dec 28, 2018

// if it was not our owner, reattach to them
if ( ( UnitState.ObjectID != OwnerStateObject.ObjectID ) || (OwnerStateObject.ObjectID != AttachedUnitRef.ObjectID) )
{
NewGameState = class'XComGameStateContext_ChangeContainer'.static.CreateChangeState("Attached Unit Died");
ItemState = XComGameState_Item(NewGameState.ModifyStateObject(Class, ObjectID));
ItemState.AttachedUnitRef = OwnerStateObject;
`GAMERULES.SubmitGameState(NewGameState);
if (UnitState != none && CosmeticUnit != none && CosmeticUnit.TileLocation != UnitState.TileLocation)
{
NewLocation = `XWORLD.GetPositionFromTileCoordinates(UnitState.TileLocation);
XGUnit(CosmeticUnit.GetVisualizer()).MoveToLocation(NewLocation);
}
}
// if it was our owner, we have to die too
else
{
if (CosmeticUnit != none)
{
NewGameState = class'XComGameStateContext_ChangeContainer'.static.CreateChangeState("Owner Unit Died");
ChangeContext = XComGameStateContext_ChangeContainer(NewGameState.GetContext());
ChangeContext.BuildVisualizationFn = ItemOwnerDeathVisualization;
CosmeticUnit = XComGameState_Unit(NewGameState.ModifyStateObject(CosmeticUnit.Class, CosmeticUnit.ObjectID));
CosmeticUnit.SetCurrentStat(eStat_HP, 0);
`GAMERULES.SubmitGameState(NewGameState);
}

//  if it was not our owner, reattach to them 
if ( ( UnitState.ObjectID != OwnerStateObject.ObjectID ) || (OwnerStateObject.ObjectID != AttachedUnitRef.ObjectID) )

Bad. When Aid Protocol is active, and the gremlin's owner dies:

  • UnitState is the unit that died (owner)
  • OwnerStateObject is the owner
  • AttachedUnitRef is the unit we are attached to

Thus, the condition evaluates to (false || true), and the gremlin doesn't die. This causes major issues with enemy gremlins, as the sweep objective won't be able to complete (unless using KillAllAIs).


I meant to report this... checks Discord... fifteen months ago, but I seem to have forgotten about it. Whoops.

@Iridar Iridar added this to the 1.26.0 milestone Jun 25, 2023
@Iridar Iridar modified the milestones: 1.26.0, 1.27.0 Aug 10, 2023
@Iridar Iridar modified the milestones: 1.27.0, 1.28.0 Oct 29, 2023
@Iridar Iridar modified the milestones: 1.28.0, 1.29.0 May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants