Merge pull request #8886 from Ghommie/Ghommie-cit137

Ports "Refactors NODROP flag into TRAIT_NODROP"
This commit is contained in:
kevinz000
2019-07-14 14:05:20 -07:00
committed by GitHub
82 changed files with 388 additions and 211 deletions
+1 -1
View File
@@ -131,7 +131,7 @@
var/obj/item/twohanded/required/chainsaw/doomslayer/chainsaw = new(victim.loc)
victim.log_message("entered a blood frenzy", LOG_ATTACK)
chainsaw.item_flags |= NODROP
ADD_TRAIT(chainsaw, TRAIT_NODROP, CHAINSAW_FRENZY_TRAIT)
victim.drop_all_held_items()
victim.put_in_hands(chainsaw, forced = TRUE)
chainsaw.attack_self(victim)
+1 -1
View File
@@ -817,6 +817,6 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
return ..()
/obj/item/throw_at(atom/target, range, speed, mob/thrower, spin=TRUE, diagonals_first = FALSE, var/datum/callback/callback)
if (item_flags & NODROP)
if (HAS_TRAIT(src, TRAIT_NODROP))
return
return ..()
+4 -3
View File
@@ -48,7 +48,7 @@
icon_state = "chronogun"
item_state = "chronogun"
w_class = WEIGHT_CLASS_NORMAL
item_flags = NODROP | DROPDEL
item_flags = DROPDEL
ammo_type = list(/obj/item/ammo_casing/energy/chrono_beam)
can_charge = 0
fire_delay = 50
@@ -58,6 +58,7 @@
/obj/item/gun/energy/chrono_gun/Initialize()
. = ..()
ADD_TRAIT(src, TRAIT_NODROP, CHRONO_GUN_TRAIT)
if(istype(loc, /obj/item/chrono_eraser))
TED = loc
else //admin must have spawned it
@@ -150,8 +151,8 @@
gun = loc
. = ..()
/obj/effect/chrono_field
+2 -2
View File
@@ -19,11 +19,11 @@
return
if(istype(target, /obj/item))
var/obj/item/I = target
if(I.item_flags & NODROP)
if(HAS_TRAIT_FROM(I, TRAIT_NODROP, GLUED_ITEM_TRAIT))
to_chat(user, "<span class='warning'>[I] is already sticky!</span>")
return
uses -= 1
I.item_flags |= NODROP
ADD_TRAIT(I, TRAIT_NODROP, GLUED_ITEM_TRAIT)
I.desc += " It looks sticky."
to_chat(user, "<span class='notice'>You smear the [I] with glue, making it incredibly sticky!</span>")
if(uses == 0)
+4 -1
View File
@@ -156,7 +156,10 @@ GLOBAL_LIST_EMPTY(GPS_list)
icon_state = "gps-b"
gpstag = "BORG0"
desc = "A mining cyborg internal positioning system. Used as a recovery beacon for damaged cyborg assets, or a collaboration tool for mining teams."
item_flags = NODROP
/obj/item/gps/cyborg/Initialize()
. = ..()
ADD_TRAIT(src, TRAIT_NODROP, CYBORG_ITEM_TRAIT)
/obj/item/gps/internal
icon_state = null
@@ -38,7 +38,7 @@
/obj/item/electropack/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/clothing/head/helmet))
var/obj/item/assembly/shock_kit/A = new /obj/item/assembly/shock_kit( user )
var/obj/item/assembly/shock_kit/A = new /obj/item/assembly/shock_kit(user)
A.icon = 'icons/obj/assemblies.dmi'
if(!user.transferItemToLoc(W, A))
@@ -53,8 +53,6 @@
user.put_in_hands(A)
A.add_fingerprint(user)
if(item_flags & NODROP)
A.item_flags |= NODROP
else
return ..()
@@ -106,8 +104,7 @@
if(shock_cooldown != 0)
return
shock_cooldown = 1
spawn(100)
shock_cooldown = 0
addtimer(VARSET_CALLBACK(src, shock_cooldown, 0), 100)
var/mob/living/L = loc
step(L, pick(GLOB.cardinals))
@@ -49,7 +49,7 @@
if(iscarbon(user))
var/mob/living/carbon/C = user
if(C.get_item_by_slot(SLOT_HEAD) == src)
if((item_flags & NODROP) && !struggling)
if(HAS_TRAIT_FROM(src, TRAIT_NODROP, REVERSE_BEAR_TRAP_TRAIT) && !struggling)
struggling = TRUE
var/fear_string
switch(time_left)
@@ -74,7 +74,7 @@
else
user.visible_message("<span class='warning'>The lock on [user]'s [name] pops open!</span>", \
"<span class='userdanger'>You force open the padlock!</span>", "<i>You hear a single, pronounced click!</i>")
item_flags &= ~NODROP
REMOVE_TRAIT(src, TRAIT_NODROP, REVERSE_BEAR_TRAP_TRAIT)
struggling = FALSE
else
..()
@@ -116,7 +116,7 @@
/obj/item/reverse_bear_trap/proc/reset()
ticking = FALSE
item_flags &= ~NODROP
REMOVE_TRAIT(src, TRAIT_NODROP, REVERSE_BEAR_TRAP_TRAIT)
soundloop.stop()
soundloop2.stop()
STOP_PROCESSING(SSprocessing, src)
@@ -125,7 +125,7 @@
ticking = TRUE
escape_chance = initial(escape_chance) //we keep these vars until re-arm, for tracking purposes
time_left = initial(time_left)
item_flags |= NODROP
ADD_TRAIT(src, TRAIT_NODROP, REVERSE_BEAR_TRAP_TRAIT)
soundloop.start()
soundloop2.mid_length = initial(soundloop2.mid_length)
soundloop2.start()
+1 -3
View File
@@ -279,9 +279,7 @@
/obj/item/book/granter/spell/barnyard/recoil(mob/living/carbon/user)
if(ishuman(user))
to_chat(user,"<font size='15' color='red'><b>HORSIE HAS RISEN</b></font>")
var/obj/item/clothing/mask/horsehead/magichead = new /obj/item/clothing/mask/horsehead
magichead.item_flags |= NODROP //curses!
magichead.flags_inv &= ~HIDEFACE //so you can still see their face
var/obj/item/clothing/magichead = new /obj/item/clothing/mask/horsehead/cursed(user.drop_location())
user.dropItemToGround(user.wear_mask, TRUE)
user.equip_to_slot_if_possible(magichead, SLOT_WEAR_MASK, TRUE, TRUE)
qdel(src)
+4 -4
View File
@@ -90,7 +90,7 @@
do_attack_animation(master, null, src)
master.emote("scream")
master.remove_status_effect(STATUS_EFFECT_HISGRACE)
item_flags &= ~NODROP
REMOVE_TRAIT(src, TRAIT_NODROP, HIS_GRACE_TRAIT)
master.Knockdown(60)
master.adjustBruteLoss(master.maxHealth)
playsound(master, 'sound/effects/splat.ogg', 100, 0)
@@ -198,20 +198,20 @@
update_stats()
/obj/item/his_grace/proc/update_stats()
item_flags &= ~NODROP
REMOVE_TRAIT(src, TRAIT_NODROP, HIS_GRACE_TRAIT)
var/mob/living/master = get_atom_on_turf(src, /mob/living)
switch(bloodthirst)
if(HIS_GRACE_CONSUME_OWNER to HIS_GRACE_FALL_ASLEEP)
if(HIS_GRACE_CONSUME_OWNER > prev_bloodthirst)
master.visible_message("<span class='userdanger'>[src] enters a frenzy!</span>")
if(HIS_GRACE_STARVING to HIS_GRACE_CONSUME_OWNER)
item_flags |= NODROP
ADD_TRAIT(src, TRAIT_NODROP, HIS_GRACE_TRAIT)
if(HIS_GRACE_STARVING > prev_bloodthirst)
master.visible_message("<span class='boldwarning'>[src] is starving!</span>", "<span class='his_grace big'>[src]'s bloodlust overcomes you. [src] must be fed, or you will become His meal.\
[force_bonus < 15 ? " And still, His power grows.":""]</span>")
force_bonus = max(force_bonus, 15)
if(HIS_GRACE_FAMISHED to HIS_GRACE_STARVING)
item_flags |= NODROP
ADD_TRAIT(src, TRAIT_NODROP, HIS_GRACE_TRAIT)
if(HIS_GRACE_FAMISHED > prev_bloodthirst)
master.visible_message("<span class='warning'>[src] is very hungry!</span>", "<span class='his_grace big'>Spines sink into your hand. [src] must feed immediately.\
[force_bonus < 10 ? " His power grows.":""]</span>")
+12 -3
View File
@@ -280,12 +280,19 @@
righthand_file = 'icons/mob/inhands/items_righthand.dmi'
name = "god hand"
desc = "This hand of yours glows with an awesome power!"
item_flags = ABSTRACT | NODROP | DROPDEL
item_flags = ABSTRACT | DROPDEL
w_class = WEIGHT_CLASS_HUGE
hitsound = 'sound/weapons/sear.ogg'
damtype = BURN
attack_verb = list("punched", "cross countered", "pummeled")
/obj/item/nullrod/godhand/Initialize()
. = ..()
ADD_TRAIT(src, TRAIT_NODROP, HAND_REPLACEMENT_TRAIT)
/obj/item/nullrod/staff
icon_state = "godstaff-red"
item_state = "godstaff-red"
@@ -525,13 +532,14 @@
lefthand_file = 'icons/mob/inhands/weapons/chainsaw_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons/chainsaw_righthand.dmi'
w_class = WEIGHT_CLASS_HUGE
item_flags = NODROP | ABSTRACT
item_flags = ABSTRACT
sharpness = IS_SHARP
attack_verb = list("sawed", "torn", "cut", "chopped", "diced")
hitsound = 'sound/weapons/chainsawhit.ogg'
/obj/item/nullrod/chainsaw/Initialize()
. = ..()
ADD_TRAIT(src, TRAIT_NODROP, HAND_REPLACEMENT_TRAIT)
AddComponent(/datum/component/butchering, 30, 100, 0, hitsound)
/obj/item/nullrod/clown
@@ -601,12 +609,13 @@
item_state = "arm_blade"
lefthand_file = 'icons/mob/inhands/antag/changeling_lefthand.dmi'
righthand_file = 'icons/mob/inhands/antag/changeling_righthand.dmi'
item_flags = ABSTRACT | NODROP
item_flags = ABSTRACT
w_class = WEIGHT_CLASS_HUGE
sharpness = IS_SHARP
/obj/item/nullrod/armblade/Initialize()
. = ..()
ADD_TRAIT(src, TRAIT_NODROP, HAND_REPLACEMENT_TRAIT)
AddComponent(/datum/component/butchering, 80, 70)
/obj/item/nullrod/armblade/tentacle
+2 -2
View File
@@ -134,7 +134,7 @@
return
update_icon()
if(sticky)
item_flags |= NODROP
ADD_TRAIT(src, TRAIT_NODROP, HOT_POTATO_TRAIT)
name = "primed [name]"
activation_time = timer + world.time
detonation_timerid = addtimer(CALLBACK(src, .proc/detonate), delay, TIMER_STOPPABLE)
@@ -147,7 +147,7 @@
/obj/item/hot_potato/proc/deactivate()
update_icon()
name = initial(name)
item_flags &= ~NODROP
REMOVE_TRAIT(src, TRAIT_NODROP, HOT_POTATO_TRAIT)
deltimer(detonation_timerid)
STOP_PROCESSING(SSfastprocess, src)
detonation_timerid = null
+3 -5
View File
@@ -92,8 +92,7 @@
/obj/item/melee/sabre/suicide_act(mob/living/user)
user.visible_message("<span class='suicide'>[user] is trying to cut off all [user.p_their()] limbs with [src]! it looks like [user.p_theyre()] trying to commit suicide!</span>")
var/i = 0
var/originally_nodropped = item_flags & NODROP
item_flags |= NODROP
ADD_TRAIT(src, TRAIT_NODROP, SABRE_SUICIDE_TRAIT)
if(iscarbon(user))
var/mob/living/carbon/Cuser = user
var/obj/item/bodypart/holding_bodypart = Cuser.get_holding_bodypart_of_item(src)
@@ -118,7 +117,7 @@
for(bodypart in limbs_to_dismember)
i++
addtimer(CALLBACK(src, .proc/suicide_dismember, user, bodypart), speedbase * i)
addtimer(CALLBACK(src, .proc/manual_suicide, user, originally_nodropped), (5 SECONDS) * i)
addtimer(CALLBACK(src, .proc/manual_suicide, user), (5 SECONDS) * i)
return MANUAL_SUICIDE
/obj/item/melee/sabre/proc/suicide_dismember(mob/living/user, obj/item/bodypart/affecting)
@@ -131,8 +130,7 @@
if(!QDELETED(user))
user.adjustBruteLoss(200)
user.death(FALSE)
if(!originally_nodropped)
item_flags &= ~NODROP
REMOVE_TRAIT(src, TRAIT_NODROP, SABRE_SUICIDE_TRAIT)
/obj/item/melee/classic_baton
name = "police baton"
+2 -2
View File
@@ -249,8 +249,8 @@
// Copied from /obj/item/melee/transforming/energy/sword/attackby
/obj/item/toy/sword/attackby(obj/item/W, mob/living/user, params)
if(istype(W, /obj/item/toy/sword))
if((W.item_flags & NODROP) || (item_flags & NODROP))
to_chat(user, "<span class='warning'>\the [item_flags & NODROP ? src : W] is stuck to your hand, you can't attach it to \the [item_flags & NODROP ? W : src]!</span>")
if(HAS_TRAIT(W, TRAIT_NODROP) || HAS_TRAIT(src, TRAIT_NODROP))
to_chat(user, "<span class='warning'>\the [HAS_TRAIT(src, TRAIT_NODROP) ? src : W] is stuck to your hand, you can't attach it to \the [HAS_TRAIT(src, TRAIT_NODROP) ? W : src]!</span>")
return
else
to_chat(user, "<span class='notice'>You attach the ends of the two plastic swords, making a single double-bladed toy! You're fake-cool.</span>")
+12 -4
View File
@@ -81,7 +81,7 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301
/obj/item/claymore/highlander //ALL COMMENTS MADE REGARDING THIS SWORD MUST BE MADE IN ALL CAPS
desc = "<b><i>THERE CAN BE ONLY ONE, AND IT WILL BE YOU!!!</i></b>\nActivate it in your hand to point to the nearest victim."
flags_1 = CONDUCT_1
item_flags = NODROP | DROPDEL
item_flags = DROPDEL
slot_flags = null
block_chance = 0 //RNG WON'T HELP YOU NOW, PANSY
light_range = 3
@@ -91,6 +91,7 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301
/obj/item/claymore/highlander/Initialize()
. = ..()
ADD_TRAIT(src, TRAIT_NODROP, HIGHLANDER)
START_PROCESSING(SSobj, src)
/obj/item/claymore/highlander/Destroy()
@@ -225,7 +226,10 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301
/obj/item/katana/cursed
slot_flags = null
item_flags = NODROP
/obj/item/katana/Initialize()
. = ..()
ADD_TRAIT(src, TRAIT_NODROP, CURSED_ITEM_TRAIT)
/obj/item/katana/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is slitting [user.p_their()] stomach open with [src]! It looks like [user.p_theyre()] trying to commit seppuku!</span>")
@@ -255,7 +259,7 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301
user.put_in_hands(S)
to_chat(user, "<span class='notice'>You fasten the glass shard to the top of the rod with the cable.</span>")
else if(istype(I, /obj/item/assembly/igniter) && !(I.item_flags & NODROP))
else if(istype(I, /obj/item/assembly/igniter) && !HAS_TRAIT(I, TRAIT_NODROP))
var/obj/item/melee/baton/cattleprod/P = new /obj/item/melee/baton/cattleprod
remove_item_from_storage(user)
@@ -418,7 +422,7 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301
item_state = "mounted_chainsaw"
lefthand_file = 'icons/mob/inhands/weapons/chainsaw_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons/chainsaw_righthand.dmi'
item_flags = NODROP | ABSTRACT | DROPDEL
item_flags = ABSTRACT | DROPDEL
w_class = WEIGHT_CLASS_HUGE
force = 24
throwforce = 0
@@ -428,6 +432,10 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301
attack_verb = list("sawed", "torn", "cut", "chopped", "diced")
hitsound = 'sound/weapons/chainsawhit.ogg'
/obj/item/mounted_chainsaw/Initialize()
. = ..()
ADD_TRAIT(src, TRAIT_NODROP, HAND_REPLACEMENT_TRAIT)
/obj/item/mounted_chainsaw/Destroy()
var/obj/item/bodypart/part
new /obj/item/twohanded/required/chainsaw(get_turf(src))
@@ -147,47 +147,48 @@
/obj/structure/closet/proc/insert(atom/movable/AM)
if(contents.len >= storage_capacity)
return -1
if(insertion_allowed(AM))
AM.forceMove(src)
return TRUE
else
return FALSE
/obj/structure/closet/proc/insertion_allowed(atom/movable/AM)
if(ismob(AM))
if(!isliving(AM)) //let's not put ghosts or camera mobs inside closets...
return
return FALSE
var/mob/living/L = AM
if(L.anchored || L.buckled || L.incorporeal_move || L.has_buckled_mobs())
return
return FALSE
if(L.mob_size > MOB_SIZE_TINY) // Tiny mobs are treated as items.
if(horizontal && L.density)
return
return FALSE
if(L.mob_size > max_mob_size)
return
return FALSE
var/mobs_stored = 0
for(var/mob/living/M in contents)
if(++mobs_stored >= mob_storage_capacity)
return
return FALSE
L.stop_pulling()
else if(istype(AM, /obj/structure/closet))
return
return FALSE
else if(istype(AM, /obj/effect))
return
return FALSE
else if(isobj(AM))
if (istype(AM, /obj/item))
var/obj/item/I = AM
if (I.item_flags & NODROP)
return
if((!allow_dense && AM.density) || AM.anchored || AM.has_buckled_mobs())
return FALSE
if(isitem(AM) && !HAS_TRAIT(AM, TRAIT_NODROP))
return TRUE
else if(!allow_objects && !istype(AM, /obj/effect/dummy/chameleon))
return
if(!allow_dense && AM.density)
return
if(AM.anchored || AM.has_buckled_mobs())
return
return FALSE
else
return
return FALSE
AM.forceMove(src)
return 1
return TRUE
/obj/structure/closet/proc/close(mob/living/user)
if(!opened || !can_close(user))
@@ -180,12 +180,13 @@
icon = 'icons/obj/items_and_weapons.dmi'
icon_state = "offhand"
w_class = WEIGHT_CLASS_HUGE
item_flags = ABSTRACT | NODROP | NOBLUDGEON | DROPDEL
item_flags = ABSTRACT | NOBLUDGEON | DROPDEL
resistance_flags = FIRE_PROOF | UNACIDABLE | ACID_PROOF
var/obj/machinery/manned_turret/turret
/obj/item/gun_control/Initialize()
. = ..()
ADD_TRAIT(src, TRAIT_NODROP, ABSTRACT_ITEM_TRAIT)
turret = loc
if(!istype(turret))
return INITIALIZE_HINT_QDEL