Hacknet-Pathfinder icon indicating copy to clipboard operation
Hacknet-Pathfinder copied to clipboard

Add `CanBeKilled` to `GameExecutable`

Open SoundOfScooting opened this issue 2 years ago • 5 comments

Improves base game behavior where DLCIntroExe and ExtensionSequencerExe will, when killed, under certain conditions, re-instantiate themselves and add to OS.exes on the next tick to prevent being killed.

If one of those executables has its conditions met, or a GameExecutable has its CanBeKilled property set, the executable cannot be removed by Programs.kill or ExeModuleExtensions.Kill.

SoundOfScooting avatar Sep 21 '22 01:09 SoundOfScooting

I'd prefer a better implementation from the get go. What you suggested would be great.

Arkhist avatar Oct 10 '22 09:10 Arkhist

Might be worth patching out the equivalent base-Hacknet hacks while we're at that?

Fayti1703 avatar Oct 10 '22 10:10 Fayti1703

It's probably better to add a patch that tries to cast the executable to a GameExecutable and does that check either without or without that boolean, so that normal game executable still function like in vanilla. Also yeah, the hacks should be patched out as best as possible, patches are preferable to hacks.

Spartan322 avatar Oct 10 '22 10:10 Spartan322

What I could do is add the check for CanBeKilled to ExeModuleExtensions.Kill and patch Programs.kill to use that. It might also be nice to change the "Process ... Ended" print if that removal is unsuccessful.

Base game executables that use this behavior are DLCIntroExe and ExtensionSequencerExe. It would suffice to hardcode the conditions for them into ExeModuleExtensions.Kill. The conditions would then always fail in the .Killed method and no new executable would be added.

SoundOfScooting avatar Oct 10 '22 13:10 SoundOfScooting

I've implemented these changes and tested them.

SoundOfScooting avatar Oct 12 '22 19:10 SoundOfScooting