4

I'm working on a mod, and I noticed this in the XCOM 2 codebase:

if(Engineer.IsAnEngineer() && !Engineer.IsDead())

(Read "If the unit is an engineer and not dead...")

Uh... can Engineers die in this game? Because it's pretty important for the correct functioning of my mod that they cannot.

3
  • 4
    @Ryan Years of software development have taught me you can't make that conclusion. That code could have been copied+pasted from somewhere unrelated to engineers; or it could have been a defensive call in case the feature was added later; or maybe the feature originally existed but was removed; or it could have been a simple mistake. Feb 9 '16 at 18:20
  • Which is why i commented. Your logical If statment is a very simple check to see if the unit is a Living engineer vs anything else, and has nothing to do with if an engineer can die or not. IsDead() will return True or false, as in there is a possiblity of returning True, the Engineer is dead.
    – Ryan
    Feb 9 '16 at 18:29
  • WHen i say does nothing for your question, i do mean nothing. Either it is used ingame and your question is answered, or it is not used in game, but it was still built to check. A check to see if something is dead or alive, No matter where it is or even if it is used does not in any way imply something can not die.
    – Ryan
    Feb 9 '16 at 18:47
3

Two things come to mind.

First, VIPs can be Scientists and Engineers (or Captured Soldiers!), so depending on where in the codebase you're looking, you might be dealing with an Engineer who hasn't been transferred back to the strategic game yet.

Secondly, there are references in the code to both Engineers and Scientists "leveling up" (to increased effectiveness), though it doesn't appear that any of this made it to the released game. Depending on how the Docs were expected to gain XP (sending them out on missions with your squad, perhaps?), there may have been a time when checking for non-dead engineers made sense, similar to how the game checks for non-dead and non-captured soldiers when filling the Armory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.