Skip to content

Commit

Permalink
Adds linting for and attach() element, and equipped() proc (#9863)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tsar-Salat authored Oct 2, 2023
1 parent caba607 commit d7759cd
Show file tree
Hide file tree
Showing 19 changed files with 56 additions and 42 deletions.
5 changes: 3 additions & 2 deletions code/_onclick/telekinesis.dm
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@
START_PROCESSING(SSfastprocess, src)

/obj/item/tk_grab/Destroy()
focus = null
STOP_PROCESSING(SSfastprocess, src)
focus = null
tk_user = null
return ..()

/obj/item/tk_grab/process()
Expand All @@ -95,10 +96,10 @@

//stops TK grabs being equipped anywhere but into hands
/obj/item/tk_grab/equipped(mob/user, slot)
. = ..()
if(slot == ITEM_SLOT_HANDS)
return
qdel(src)
return

/obj/item/tk_grab/examine(user)
if (focus)
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/globals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ GLOBAL_REAL(GLOB, /datum/controller/global_vars)

/datum/controller/global_vars/Destroy(force)
// This is done to prevent an exploit where admins can get around protected vars
SHOULD_CALL_PARENT(0)
SHOULD_CALL_PARENT(FALSE)
return QDEL_HINT_IWILLGC

/datum/controller/global_vars/stat_entry()
Expand Down
1 change: 1 addition & 0 deletions code/datums/components/twohanded.dm
Original file line number Diff line number Diff line change
Expand Up @@ -396,5 +396,6 @@
var/wielded = FALSE

/obj/item/offhand/equipped(mob/user, slot)
. = ..()
if(wielded && !user.is_holding(src))
qdel(src)
1 change: 1 addition & 0 deletions code/datums/elements/_element.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
var/id_arg_index = INFINITY

/datum/element/proc/Attach(datum/target)
SHOULD_CALL_PARENT(TRUE)
if(type == /datum/element)
return ELEMENT_INCOMPATIBLE
SEND_SIGNAL(target, COMSIG_ELEMENT_ATTACH, src)
Expand Down
3 changes: 2 additions & 1 deletion code/datums/martial/boxing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@
log_combat(A, D, "knocked out (boxing) ")
else if(!(D.mobility_flags & MOBILITY_STAND))
D.force_say(A)
return 1
return TRUE

/obj/item/clothing/gloves/boxing
var/datum/martial_art/boxing/style = new

/obj/item/clothing/gloves/boxing/equipped(mob/user, slot)
..()
if(!ishuman(user))
return
if(slot == ITEM_SLOT_GLOVES)
Expand Down
3 changes: 2 additions & 1 deletion code/datums/martial/krav_maga.dm
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,15 @@
var/datum/martial_art/krav_maga/style = new

/obj/item/clothing/gloves/krav_maga/equipped(mob/user, slot)
. = ..()
if(!ishuman(user))
return
if(slot == ITEM_SLOT_GLOVES)
var/mob/living/carbon/human/H = user
style.teach(H,1)

/obj/item/clothing/gloves/krav_maga/dropped(mob/user)
..()
. = ..()
if(!ishuman(user))
return
var/mob/living/carbon/human/H = user
Expand Down
3 changes: 2 additions & 1 deletion code/datums/martial/wrestling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@
var/datum/martial_art/wrestling/style = new

/obj/item/storage/belt/champion/wrestling/equipped(mob/user, slot)
. = ..()
if(!ishuman(user))
return
if(slot == ITEM_SLOT_BELT)
Expand All @@ -463,7 +464,7 @@
return

/obj/item/storage/belt/champion/wrestling/dropped(mob/user)
..()
. = ..()
if(!ishuman(user))
return
var/mob/living/carbon/human/H = user
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
// for items that can be placed in multiple slots
// note this isn't called during the initial dressing of a player
/obj/item/proc/equipped(mob/user, slot, initial = FALSE)
SHOULD_CALL_PARENT(TRUE)
SEND_SIGNAL(src, COMSIG_ITEM_EQUIPPED, user, slot)
SEND_SIGNAL(user, COMSIG_MOB_EQUIPPED_ITEM, src, slot)
for(var/X in actions)
Expand Down
3 changes: 2 additions & 1 deletion code/game/objects/items/cigs_lighters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
reagents.clear_reagents()

/obj/item/clothing/mask/vape/equipped(mob/user, slot)
. = ..()
if(slot == ITEM_SLOT_MASK)
if(!screw)
to_chat(user, "<span class='notice'>You start puffing on the vape.</span>")
Expand All @@ -924,7 +925,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
to_chat(user, "<span class='warning'>You need to close the cap first!</span>")

/obj/item/clothing/mask/vape/dropped(mob/user)
..()
. = ..()
if(user.get_item_by_slot(ITEM_SLOT_MASK) == src)
ENABLE_BITFIELD(reagents.flags, NO_REACT)
STOP_PROCESSING(SSobj, src)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/pitchfork.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
return (BRUTELOSS)

/obj/item/pitchfork/demonic/pickup(mob/living/user)
..()
. = ..()
if(isliving(user) && user.mind && user.owns_soul() && !is_devil(user))
var/mob/living/U = user
U.visible_message("<span class='warning'>As [U] picks [src] up, [U]'s arms briefly catch fire.</span>", \
Expand Down
3 changes: 2 additions & 1 deletion code/game/objects/items/robot/robot_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,11 @@
emaggedhitdamage = 0

/obj/item/borg/lollipop/equipped()
. = ..()
check_amount()

/obj/item/borg/lollipop/dropped()
..()
. = ..()
check_amount()

/obj/item/borg/lollipop/proc/check_amount() //Doesn't even use processing ticks.
Expand Down
8 changes: 3 additions & 5 deletions code/game/objects/items/weaponry.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,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 = DROPDEL | ISWEAPON
item_flags = DROPDEL | ISWEAPON //dropdel occurs because you lost an arm
slot_flags = null
light_range = 3
attack_verb = list("brutalized", "eviscerated", "disemboweled", "hacked", "carved", "cleaved") //ONLY THE MOST VISCERAL ATTACK VERBS
Expand Down Expand Up @@ -128,16 +128,14 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301


/obj/item/claymore/highlander/pickup(mob/living/user)
..()
. = ..()
to_chat(user, "<span class='notice'>The power of Scotland protects you! You are shielded from all stuns and knockdowns.</span>")
user.add_stun_absorption("highlander", INFINITY, 1, " is protected by the power of Scotland!", "The power of Scotland absorbs the stun!", " is protected by the power of Scotland!")
user.ignore_slowdown(HIGHLANDER)

/obj/item/claymore/highlander/dropped(mob/living/user)
..()
. = ..()
user.unignore_slowdown(HIGHLANDER)
if(!QDELETED(src))
qdel(src) //If this ever happens, it's because you lost an arm

/obj/item/claymore/highlander/examine(mob/user)
. = ..()
Expand Down
1 change: 1 addition & 0 deletions code/modules/awaymissions/mission_code/Academy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@
addtimer(CALLBACK(src, PROC_REF(effect), user, .), 1 SECONDS)

/obj/item/dice/d20/fate/equipped(mob/user, slot)
. = ..()
if(!ishuman(user) || !user.mind || (user.mind in SSticker.mode.wizards))
to_chat(user, "<span class='warning'>You feel the magic of the dice is restricted to ordinary humans! You should leave it alone.</span>")
user.dropItemToGround(src)
Expand Down
3 changes: 2 additions & 1 deletion code/modules/clothing/head/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,15 @@
var/datum/language/piratespeak/L = new

/obj/item/clothing/head/pirate/equipped(mob/user, slot)
. = ..()
if(!ishuman(user))
return
if(slot == ITEM_SLOT_HEAD)
user.grant_language(/datum/language/piratespeak/, TRUE, TRUE, LANGUAGE_HAT)
to_chat(user, "You suddenly know how to speak like a pirate!")

/obj/item/clothing/head/pirate/dropped(mob/user)
..()
. = ..()
if(!ishuman(user))
return
var/mob/living/carbon/human/H = user
Expand Down
1 change: 1 addition & 0 deletions code/modules/clothing/head/soft_caps.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
user.update_inv_head() //so our mob-overlays update

/obj/item/clothing/head/soft/equipped(mob/user, slot)
. = ..()
if(slot == ITEM_SLOT_HEAD)
if(HAS_TRAIT(user, TRAIT_PROSKATER))
if(!flipped)
Expand Down
52 changes: 27 additions & 25 deletions code/modules/clothing/masks/cluwne.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@
return SPEECH_MESSAGE

/obj/item/clothing/mask/cluwne/equipped(mob/user, slot)
if(!user.has_dna())
return
if(slot == ITEM_SLOT_MASK)
var/mob/living/carbon/C = user
C.dna.add_mutation(CLUWNEMUT)
return
. = ..()
if(!user.has_dna())
return
if(slot == ITEM_SLOT_MASK)
var/mob/living/carbon/C = user
C.dna.add_mutation(CLUWNEMUT)
return

/obj/item/clothing/mask/cluwne/happy_cluwne
name = "Happy Cluwne Mask"
Expand All @@ -83,22 +84,23 @@
play_laugh1()

/obj/item/clothing/mask/cluwne/happy_cluwne/equipped(mob/user, slot)
if(!ishuman(user))
return
var/mob/living/carbon/human/H = user
if(slot == ITEM_SLOT_MASK)
if(is_cursed && can_cluwne) //logic predetermined
log_admin("[key_name(H)] was made into a cluwne by [src]")
message_admins("[key_name(H)] got cluwned by [src]")
to_chat(H, "<span class='userdanger'>The masks straps suddenly tighten to your face and your thoughts are erased by a horrible green light!</span>")
H.dropItemToGround(src)
H.cluwneify()
qdel(src)
else if(is_very_cursed && can_cluwne)
var/turf/T = get_turf(src)
var/mob/living/simple_animal/hostile/floor_cluwne/S = new(T)
S.Acquire_Victim(user)
log_admin("[key_name(user)] summoned a floor cluwne using the [src]")
message_admins("[key_name(user)] summoned a floor cluwne using the [src]")
to_chat(H, "<span class='warning'>The mask suddenly slips off your face and... slides under the floor?</span>")
to_chat(H, "<i>...dneirf uoy ot gnoleb ton seod tahT</i>")
. = ..()
if(!ishuman(user))
return
var/mob/living/carbon/human/H = user
if(slot == ITEM_SLOT_MASK)
if(is_cursed && can_cluwne) //logic predetermined
log_admin("[key_name(H)] was made into a cluwne by [src]")
message_admins("[key_name(H)] got cluwned by [src]")
to_chat(H, "<span class='userdanger'>The masks straps suddenly tighten to your face and your thoughts are erased by a horrible green light!</span>")
H.dropItemToGround(src)
H.cluwneify()
qdel(src)
else if(is_very_cursed && can_cluwne)
var/turf/T = get_turf(src)
var/mob/living/simple_animal/hostile/floor_cluwne/S = new(T)
S.Acquire_Victim(user)
log_admin("[key_name(user)] summoned a floor cluwne using the [src]")
message_admins("[key_name(user)] summoned a floor cluwne using the [src]")
to_chat(H, "<span class='warning'>The mask suddenly slips off your face and... slides under the floor?</span>")
to_chat(H, "<i>...dneirf uoy ot gnoleb ton seod tahT</i>")
1 change: 1 addition & 0 deletions code/modules/clothing/shoes/cluwne.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
footstep++

/obj/item/clothing/shoes/cluwne/equipped(mob/user, slot)
. = ..()
if(!user.has_dna())
return
if(slot == ITEM_SLOT_FEET)
Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/living/carbon/alien/special/facehugger.dm
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
Die()

/obj/item/clothing/mask/facehugger/equipped(mob/M)
. = ..()
Attach(M)
compile_monkey_icon()

Expand Down
4 changes: 2 additions & 2 deletions code/modules/projectiles/guns/ballistic/pistol.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@
desc = "A 2 dimensional gun.. what?"
icon_state = "flatgun"

/obj/item/gun/ballistic/automatic/pistol/stickman/pickup(mob/living/user)
/obj/item/gun/ballistic/automatic/pistol/stickman/equipped(mob/user, slot)
..()
to_chat(user, "<span class='notice'>As you try to pick up [src], it slips out of your grip..</span>")
to_chat(user, "<span class='notice'>As you try to manipulate [src], it slips out of your possession..</span>")
if(prob(50))
to_chat(user, "<span class='notice'>..and vanishes from your vision! Where the hell did it go?</span>")
qdel(src)
Expand Down

0 comments on commit d7759cd

Please sign in to comment.