Hacknet-Pathfinder
Hacknet-Pathfinder copied to clipboard
Add `CanBeKilled` to `GameExecutable`
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
.
I'd prefer a better implementation from the get go. What you suggested would be great.
Might be worth patching out the equivalent base-Hacknet hacks while we're at that?
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.
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.
I've implemented these changes and tested them.