Refactors NODROP flag into TRAIT_NODROP (#42109)

* Refactors NODROP flag into TRAIT_NODROP

🆑 coiax
fix: Anti-drop implants can no longer be used to drop objects that they
were not responsible for sticking to a person's hand.
fix: Backfiring with a Barnyard spellbook will now play a spooky horse sound.
refactor: Refactors the way that "NODROP" items work to a new system,
there should be no change in functionality.
/🆑

Various items in the codebase were doing weird hoop jumps in order to
preserve the nodrop flag's state when it also wanted to change it, so I
moved it to a trait system.

I may have gone overboard with the type of unique trait sources, but
those can be changed later. My long term plan is make a general "CURSED"
nodrop origin, which means you can unlock cursed items by being hit with
a bolt of door opening or something. But that's for another PR, this has
no functionality changes, apart from some slightly modified descriptions
on cursed masks.

- Removed a bunch of redundant voice changing code for all the voice
changing animal masks, used two new clothing flags for this purpose.
- Also refactored a bit the animal masks, making new cursed subtypes that play
the sound when created.

* Drop location
This commit is contained in:
coiax
2019-01-17 20:24:30 +00:00
committed by yogstation13-bot
parent 8b4c9c6eee
commit 66df5546ee
81 changed files with 382 additions and 225 deletions

View File

@@ -272,7 +272,7 @@
/mob/proc/canUnEquip(obj/item/I, force)
if(!I)
return TRUE
if((I.item_flags & NODROP) && !force)
if(I.has_trait(TRAIT_NODROP) && !force)
return FALSE
return TRUE
@@ -306,13 +306,13 @@
//DO NOT CALL THIS PROC
//use one of the above 3 helper procs
//you may override it, but do not modify the args
/mob/proc/doUnEquip(obj/item/I, force, newloc, no_move, invdrop = TRUE) //Force overrides NODROP_1 for things like wizarditis and admin undress.
/mob/proc/doUnEquip(obj/item/I, force, newloc, no_move, invdrop = TRUE) //Force overrides TRAIT_NODROP for things like wizarditis and admin undress.
//Use no_move if the item is just gonna be immediately moved afterward
//Invdrop is used to prevent stuff in pockets dropping. only set to false if it's going to immediately be replaced
if(!I) //If there's nothing to drop, the drop is automatically succesfull. If(unEquip) should generally be used to check for NODROP_1.
if(!I) //If there's nothing to drop, the drop is automatically succesfull. If(unEquip) should generally be used to check for TRAIT_NODROP.
return TRUE
if((I.item_flags & NODROP) && !force)
if(I.has_trait(TRAIT_NODROP) && !force)
return FALSE
var/hand_index = get_held_index_of_item(I)