cataclysmbnteam / Cataclysm-BN

Cataclysm: Bright Nights, A fork/variant of Cataclysm:DDA by CleverRaven.
https://docs.cataclysmbn.org
Other
696 stars 272 forks source link

NPCs will drop bionic weapons if slain #1218

Closed chaosvolt closed 2 years ago

chaosvolt commented 2 years ago

Describe the bug

If an NPC is set to use a weapon bionic, for example Chain Lightning, and are killed while it's active, they'll drop the otherwise unobtainable bionic weapon on death. Since these item have the NO_UNWIELD flags, picking them up and wielding them is also a Bad Idea.

Steps To Reproduce

  1. Obtain an NPC that has bionics installed on them, in particular a bionic weapon.
  2. Piss them off and wait for them to swap out for their bionic weapon.
  3. Kill them and take their pseudo item.

Expected behavior

Either:

  1. For bionic weapons to correctly cleanup on NPC death.
  2. For bionic weapons to not have the NPC_USABLE flag if this is otherwise impossible to avoid.

Screenshots

image

Versions and configuration

Additional context

I'm not sure if this even shows up in vanilla. The only NPC to start with bionics is the prototype cyborg if I recall, who has fingertip razors instead. Can you install CBMs on NPCs via an autodoc?

Coolthulhu commented 2 years ago

This exact bug is Cata++ problem, but it would happen in vanilla as well: bionic claws and monomolecular blade do not have the no-drop flag, so the only thing preventing them from existing as standalone items is that they can't be dropped in most ways.

chaosvolt commented 2 years ago

That's what I was asking about, can it be induced in vanilla? I'm fairly certain you can install them on an NPC via an autodoc?

Coolthulhu commented 2 years ago

Not sure, but I think a dying player character will do the same thing, meaning it's still replicable.

chaosvolt commented 2 years ago

Nice. So adding NO_DROP to the item should suffice? If I get the chance to test it today while I'm out, might be able to PR a fix for it then.

chaosvolt commented 2 years ago

Good news from my findings, adding NO_DROP seems to work as expected without messing with bionic weapon behavior, for both bionic melee weapons and bionic ranged weapons.

However, bionic ranged weapons still act up a bit in other ways when given to NPCs. They seem to treat them like bionic melee weapons, wielding them when activated. This draws up the placeholder sprite it's given (at least in UDP) when it's not shown for players firing it, suggesting that it's being called up in a different manner when NPCs use it.

They then don't even seem to properly unwield it, or at least I've yet to cajole one into unwielding it, and they'll just shoot the player with it constantly. Soon as I stepped within a few tiles of the test NPC he killed me with a single dozen-round burst. Goading another such NPC into trying the same jackass stunt and killing him before he could fire had the wielded pseudoitem correctly vanish on death, as mentioned above.

So based off this I'd likely:

  1. For BN, PR a change that gives NO_DROP to all bionic weapons, including the ranged ones just in case, but also remove BIONIC_NPC_USABLE from the ranged bionics until that behavior is fixed. That should (I think?) prevent players from autodoc'ing the offending bionics onto an NPC, which should be the only
  2. Send Noct a corresponding fix for Cata++ that removes use of ranged bionics from any NPCs that have it. Relatively certain the Red Team gladiator NPCs might be the only instance of that.
chaosvolt commented 2 years ago

Side note, I finally decided to test if you can install bionics on NPCs via an autodoc. Get a companion NPC, get them standing on an autodoc couch, examine it with the stuff needed to install... image

You can indeed install bionics onto NPCs, though looks like it's more along the lines of forcing the NPC to self-install: image

Next I'm going to make sure that removing the flag for NPC use is what actually controls if you can install it on an NPC or not.

EDIT: Yep, removing that flag will prevent installation: image

chaosvolt commented 2 years ago

Follow-up: it seems that bionic melee weapons still cleanup properly in the case of players dropping them on death, even without NO_DROP. I don't know if this means if:

  1. NPCs with bionic melee weapons will still fail cleanup.
  2. Or if it's something caused solely by an NPC ending up wielding an item that their CBM says should only exist in the liminal state of being used as gun without actually being wielded that player bionic ranged weapons do.

Just in case I'll still go through with using NO_DROP so that cleanup will happen correctly if other things break in the future.