Adds CI to forbid some istype(src) checks. (#26980)

* first set of changes

* the last checks

* actually builds

* Update code/modules/surgery/organs/subtypes/standard_organs.dm

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Signed-off-by: Contrabang <91113370+Contrabang@users.noreply.github.com>

* Update tools/ci/check_grep2.py

Signed-off-by: Contrabang <91113370+Contrabang@users.noreply.github.com>

* 1 fix (cigarettes) and better encapsulation in files

* yeeep

---------

Signed-off-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
This commit is contained in:
Contrabang
2024-11-06 12:56:36 +00:00
committed by GitHub
co-authored by Luc
parent 5ac9a04796
commit 0f717d660a
33 changed files with 178 additions and 149 deletions
+16 -16
View File
@@ -194,6 +194,21 @@
return access
return access | guest_pass.GetAccess()
/obj/item/card/id/proc/attach_guest_pass(obj/item/card/id/guest/G, mob/user)
if(world.time > G.expiration_time)
to_chat(user, "There's no point, the guest pass has expired.")
return
if(guest_pass)
to_chat(user, "There's already a guest pass attached to this ID.")
return
if(G.registered_name != registered_name && G.registered_name != "NOT SPECIFIED")
to_chat(user, "The guest pass cannot be attached to this ID.")
return
if(!user.unEquip(G))
return
G.loc = src
guest_pass = G
/obj/item/card/id/GetID()
return src
@@ -266,22 +281,7 @@
to_chat(user, "This ID has already been stamped!")
else if(istype(W, /obj/item/card/id/guest))
if(istype(src, /obj/item/card/id/guest))
return
var/obj/item/card/id/guest/G = W
if(world.time > G.expiration_time)
to_chat(user, "There's no point, the guest pass has expired.")
return
if(guest_pass)
to_chat(user, "There's already a guest pass attached to this ID.")
return
if(G.registered_name != registered_name && G.registered_name != "NOT SPECIFIED")
to_chat(user, "The guest pass cannot be attached to this ID")
return
if(!user.unEquip(G))
return
G.loc = src
guest_pass = G
attach_guest_pass(W, user)
/obj/item/card/id/AltClick(mob/user)
if(user.stat || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || !Adjacent(user))
+6 -6
View File
@@ -33,8 +33,8 @@ LIGHTERS ARE IN LIGHTERS.DM
var/icon_on = "cigon" //Note - these are in masks.dmi not in cigarette.dmi
/// Unlit cigarette sprite.
var/icon_off = "cigoff"
/// Are we an extra-classy smokable?
var/fancy = FALSE
/// Do we require special items to be lit?
var/list/fancy_lighters = list()
/// What trash item the cigarette makes when it burns out.
var/type_butt = /obj/item/cigbutt
/// How long does the cigarette last before going out? Decrements by 1 every cycle.
@@ -108,7 +108,7 @@ LIGHTERS ARE IN LIGHTERS.DM
else
to_chat(user, "<span class='notice'>You put [src] into your mouth.</span>")
return TRUE
// If they DO have a cig, try to light it with your own cig.
if(!cigarette_lighter_act(user, M))
return ..()
@@ -417,7 +417,7 @@ LIGHTERS ARE IN LIGHTERS.DM
icon_on = "cigaron"
icon_off = "cigaroff"
throw_speed = 0.5
fancy = TRUE
fancy_lighters = list(/obj/item/match, /obj/item/lighter/zippo)
type_butt = /obj/item/cigbutt/cigarbutt
smoketime = 300
chem_volume = 120
@@ -523,7 +523,7 @@ LIGHTERS ARE IN LIGHTERS.DM
item_state = "pipeoff"
icon_on = "pipeon" //Note - these are in masks.dmi
icon_off = "pipeoff"
fancy = TRUE
fancy_lighters = list(/obj/item/match, /obj/item/lighter/zippo)
smoketime = 500
chem_volume = 200
list_reagents = list("nicotine" = 200)
@@ -583,7 +583,7 @@ LIGHTERS ARE IN LIGHTERS.DM
else
to_chat(user, "<span class='warning'>You need to dry this first!</span>")
return
return ..()
/obj/item/clothing/mask/cigarette/pipe/cobpipe
+12 -6
View File
@@ -214,9 +214,7 @@
materials = list()
trashtype = /obj/item/restraints/handcuffs/cable/zipties/used
/obj/item/restraints/handcuffs/cable/zipties/cyborg/attack(mob/living/carbon/C, mob/user)
if(isrobot(user))
cuff(C, user, FALSE)
/obj/item/restraints/handcuffs/cable/zipties/used
desc = "A pair of broken zipties."
@@ -268,10 +266,10 @@
//////////////////////////////
/obj/item/restraints/handcuffs/cable/attackby(obj/item/I, mob/user, params)
..()
// Don't allow borgs to send their their ziptie module to the shadow realm.
if(istype(src, /obj/item/restraints/handcuffs/cable/zipties/cyborg))
return
handle_attack_construction(I, user)
/obj/item/restraints/handcuffs/cable/proc/handle_attack_construction(obj/item/I, mob/user)
if(istype(I, /obj/item/stack/rods))
var/obj/item/stack/rods/R = I
if(!R.use(1))
@@ -306,3 +304,11 @@
if(istype(I, /obj/item/toy/crayon))
var/obj/item/toy/crayon/C = I
cable_color(C.dye_color)
/obj/item/restraints/handcuffs/cable/zipties/cyborg/attack(mob/living/carbon/C, mob/user)
if(isrobot(user))
cuff(C, user, FALSE)
/obj/item/restraints/handcuffs/cable/zipties/cyborg/handle_attack_construction(obj/item/I, mob/user)
// Don't allow borgs to send their their ziptie module to the shadow realm.
return
+1 -1
View File
@@ -383,7 +383,7 @@
lit = TRUE
w_class = WEIGHT_CLASS_BULKY //to prevent it going to pockets
is_unathi_fire = TRUE
/obj/item/match/unathi/cigarette_lighter_act(mob/living/target, mob/living/user, obj/item/direct_attackby_item)
var/obj/item/clothing/mask/cigarette/cig = ..()
if(!cig)
@@ -36,6 +36,13 @@
else
. += "There are [length(contents)] [icon_type]s in the box."
/obj/item/storage/fancy/remove_from_storage(obj/item/I, atom/new_location)
if(!istype(I))
return FALSE
update_icon()
return ..()
/*
* Donut Box
*/
@@ -503,10 +503,6 @@
if(!istype(I))
return FALSE
if(istype(src, /obj/item/storage/fancy))
var/obj/item/storage/fancy/F = src
F.update_icon()
for(var/_M in mobs_viewing)
var/mob/M = _M
if((M.s_active == src) && M.client)