From 0f717d660a4f1ea82972f431e8c567260a40eef7 Mon Sep 17 00:00:00 2001
From: Contrabang <91113370+Contrabang@users.noreply.github.com>
Date: Wed, 6 Nov 2024 07:56:36 -0500
Subject: [PATCH] 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>
---
code/game/atoms.dm | 4 +-
code/game/gamemodes/cult/runes.dm | 19 +++++---
code/game/machinery/guestpass.dm | 3 ++
code/game/machinery/recharger.dm | 4 +-
code/game/mecha/equipment/mecha_equipment.dm | 8 ++--
code/game/mecha/equipment/weapons/weapons.dm | 3 ++
.../effects/decals/Cleanable/humans.dm | 6 ++-
.../effects/decals/Cleanable/tracks.dm | 3 ++
code/game/objects/effects/effects.dm | 5 ++
code/game/objects/items.dm | 4 +-
code/game/objects/items/weapons/cards_ids.dm | 32 ++++++-------
code/game/objects/items/weapons/cigs.dm | 12 ++---
code/game/objects/items/weapons/handcuffs.dm | 18 +++++---
code/game/objects/items/weapons/lighters.dm | 2 +-
.../objects/items/weapons/storage/fancy.dm | 7 +++
.../items/weapons/storage/storage_base.dm | 4 --
code/game/objects/structures/signs.dm | 6 ++-
code/game/objects/structures/tables_racks.dm | 22 ++++-----
.../atmospherics/machinery/atmospherics.dm | 8 +++-
.../atmospherics/machinery/pipes/pipe.dm | 4 ++
.../ghost_role_spawners/golems.dm | 46 +++++++++++--------
code/modules/clothing/clothing.dm | 20 ++------
code/modules/hydroponics/hydroponics_tray.dm | 7 ++-
.../mob/living/carbon/human/human_mob.dm | 6 +--
code/modules/mob/living/living.dm | 3 +-
.../simple_animal/bot/bot_construction.dm | 2 +-
code/modules/mob/mob.dm | 10 ++--
code/modules/paperwork/photography.dm | 26 ++++++-----
.../power/engines/supermatter/supermatter.dm | 5 +-
.../projectiles/guns/projectile/revolver.dm | 16 ++-----
code/modules/surgery/organs/organ_external.dm | 2 -
.../organs/subtypes/standard_organs.dm | 4 ++
tools/ci/check_grep2.py | 6 +++
33 files changed, 178 insertions(+), 149 deletions(-)
diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index c0c5584a6bc..b709a081593 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -354,7 +354,7 @@
/atom/proc/in_contents_of(container)//can take class or object instance as argument
if(ispath(container))
- if(istype(src.loc, container))
+ if(istype(loc, container))
return TRUE
else if(src in container)
return TRUE
@@ -388,7 +388,7 @@
/atom/proc/build_base_description(infix = "", suffix = "")
//This reformat names to get a/an properly working on item descriptions when they are bloody
var/f_name = "\a [src][infix]."
- if(src.blood_DNA && !istype(src, /obj/effect/decal))
+ if(src.blood_DNA)
if(gender == PLURAL)
f_name = "some "
else
diff --git a/code/game/gamemodes/cult/runes.dm b/code/game/gamemodes/cult/runes.dm
index 234bdcaf83b..bb89b65ebbd 100644
--- a/code/game/gamemodes/cult/runes.dm
+++ b/code/game/gamemodes/cult/runes.dm
@@ -77,14 +77,9 @@ To draw a rune, use a ritual dagger.
/obj/effect/rune/attackby(obj/I, mob/user, params)
if(istype(I, /obj/item/melee/cultblade/dagger) && IS_CULTIST(user))
- // Telerunes with portals open
- if(istype(src, /obj/effect/rune/teleport))
- var/obj/effect/rune/teleport/T = src // Can't erase telerunes if they have a portal open
- if(T.inner_portal || T.outer_portal)
- to_chat(user, "The portal needs to close first!")
- return
+ if(!can_dagger_erase_rune(user))
+ return
- // Everything else
var/obj/item/melee/cultblade/dagger/D = I
user.visible_message("[user] begins to erase [src] with [I].")
if(do_after(user, initial(scribe_delay) * D.scribe_multiplier, target = src))
@@ -102,6 +97,9 @@ To draw a rune, use a ritual dagger.
return
return ..()
+/obj/effect/rune/proc/can_dagger_erase_rune(mob/user)
+ return TRUE
+
/obj/effect/rune/attack_hand(mob/living/user)
user.Move_Pulled(src) // So that you can still drag things onto runes
if(!IS_CULTIST(user))
@@ -453,6 +451,13 @@ structure_check() searches for nearby cultist structures required for the invoca
QDEL_NULL(outer_portal)
return ..()
+/obj/effect/rune/teleport/can_dagger_erase_rune(mob/user)
+ // Can't erase telerunes if they have a portal open
+ if(inner_portal || outer_portal)
+ to_chat(user, "The portal needs to close first!")
+ return FALSE
+ return TRUE
+
/obj/effect/rune/teleport/invoke(list/invokers)
var/mob/living/user = invokers[1] //the first invoker is always the user
var/list/potential_runes = list()
diff --git a/code/game/machinery/guestpass.dm b/code/game/machinery/guestpass.dm
index 10d2c19e1b7..45bf5a158a7 100644
--- a/code/game/machinery/guestpass.dm
+++ b/code/game/machinery/guestpass.dm
@@ -10,6 +10,9 @@
var/expiration_time = 0
var/reason = "NOT SPECIFIED"
+/obj/item/card/id/guest/attach_guest_pass(/obj/item/card/id/guest/G, mob/user)
+ return
+
/obj/item/card/id/guest/GetAccess()
if(world.time > expiration_time)
return access
diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm
index 633683cc3fd..27d6fae25cf 100644
--- a/code/game/machinery/recharger.dm
+++ b/code/game/machinery/recharger.dm
@@ -17,6 +17,7 @@
var/obj/item/charging = null // The item that is being charged
var/using_power = FALSE // Whether the recharger is actually transferring power or not, used for icon
+ var/anchor_toggleable = TRUE
/obj/machinery/recharger/Initialize(mapload)
. = ..()
@@ -91,7 +92,7 @@
/obj/machinery/recharger/wrench_act(mob/user, obj/item/I)
. = TRUE
- if(istype(src, /obj/machinery/recharger/wallcharger)) // Unwrenching wall rechargers and dragging them off all kinds of cursed.
+ if(!anchor_toggleable) // Unwrenching wall rechargers and dragging them off all kinds of cursed.
return
if(panel_open)
to_chat(user, "Close the maintenance panel first!")
@@ -258,6 +259,7 @@
name = "wall recharger"
icon_state = "wrecharger0"
base_icon_state = "wrecharger"
+ anchor_toggleable = FALSE
/obj/machinery/recharger/wallcharger/upgraded/Initialize(mapload)
. = ..()
diff --git a/code/game/mecha/equipment/mecha_equipment.dm b/code/game/mecha/equipment/mecha_equipment.dm
index 89dbec60458..18ca35e6a39 100644
--- a/code/game/mecha/equipment/mecha_equipment.dm
+++ b/code/game/mecha/equipment/mecha_equipment.dm
@@ -32,14 +32,14 @@
if(chassis)
chassis.occupant_message("[src] is destroyed!")
chassis.log_append_to_last("[src] is destroyed.",1)
- if(istype(src, /obj/item/mecha_parts/mecha_equipment/weapon))
- SEND_SOUND(chassis.occupant, sound(chassis.weapdestrsound, volume = 50))
- else
- SEND_SOUND(chassis.occupant, sound(chassis.critdestrsound, volume = 50))
+ SEND_SOUND(chassis.occupant, sound(get_destroy_sound(), volume = 50))
detach(chassis)
return ..()
+/obj/item/mecha_parts/mecha_equipment/proc/get_destroy_sound()
+ return chassis.critdestrsound
+
/obj/item/mecha_parts/mecha_equipment/proc/get_equip_info()
if(!chassis)
return
diff --git a/code/game/mecha/equipment/weapons/weapons.dm b/code/game/mecha/equipment/weapons/weapons.dm
index bcd474cd407..5e02b662dfa 100644
--- a/code/game/mecha/equipment/weapons/weapons.dm
+++ b/code/game/mecha/equipment/weapons/weapons.dm
@@ -25,6 +25,9 @@
/obj/item/mecha_parts/mecha_equipment/weapon/proc/get_shot_amount()
return projectiles_per_shot
+/obj/item/mecha_parts/mecha_equipment/weapon/get_destroy_sound()
+ return chassis.weapdestrsound
+
/obj/item/mecha_parts/mecha_equipment/weapon/action(target, params)
if(!action_checks(target))
return
diff --git a/code/game/objects/effects/decals/Cleanable/humans.dm b/code/game/objects/effects/decals/Cleanable/humans.dm
index 152ce009b9e..5b8c6009334 100644
--- a/code/game/objects/effects/decals/Cleanable/humans.dm
+++ b/code/game/objects/effects/decals/Cleanable/humans.dm
@@ -55,7 +55,7 @@
var/turf/T = get_turf(src)
check_gravity(T)
- if(!istype(src, /obj/effect/decal/cleanable/blood/footprints) && ((T && (T.density)) || !gravity_check || locate(/obj/structure/window/full) in T || locate(/obj/structure/grille/) in T))
+ if(should_be_off_floor())
off_floor = TRUE
layer = ABOVE_MOB_LAYER
plane = GAME_PLANE
@@ -85,6 +85,10 @@
overlays.Cut()
..()
+/obj/effect/decal/cleanable/blood/proc/should_be_off_floor()
+ var/turf/T = get_turf(src)
+ return ((T && T.density) || !gravity_check || (locate(/obj/structure/window/full) in T) || (locate(/obj/structure/grille) in T))
+
/obj/effect/decal/cleanable/blood/proc/dry()
name = dryname
desc = drydesc
diff --git a/code/game/objects/effects/decals/Cleanable/tracks.dm b/code/game/objects/effects/decals/Cleanable/tracks.dm
index 0d543775c74..bf232ca56aa 100644
--- a/code/game/objects/effects/decals/Cleanable/tracks.dm
+++ b/code/game/objects/effects/decals/Cleanable/tracks.dm
@@ -123,6 +123,9 @@ GLOBAL_LIST_EMPTY(fluidtrack_cache)
alpha = base_alpha + bloodiness
+/obj/effect/decal/cleanable/blood/footprints/should_be_off_floor()
+ return FALSE
+
/proc/createFootprintsFrom(atom/movable/A, dir, turf/T)
var/obj/effect/decal/cleanable/blood/footprints/FP = new /obj/effect/decal/cleanable/blood/footprints(T)
if(ishuman(A))
diff --git a/code/game/objects/effects/effects.dm b/code/game/objects/effects/effects.dm
index 4a9e2500c02..924c49f6fc4 100644
--- a/code/game/objects/effects/effects.dm
+++ b/code/game/objects/effects/effects.dm
@@ -98,6 +98,11 @@
create_reagents(100)
reagents.add_reagent_list(scoop_reagents)
+/obj/effect/decal/build_base_description(infix, suffix) // overriding this is a sin but it fixes a worse sin
+ . = list("[bicon(src)] That's \a [src][infix]. [suffix]")
+ if(desc)
+ . += desc
+
/obj/effect/decal/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/reagent_containers/glass) || istype(I, /obj/item/reagent_containers/drinks))
scoop(I, user)
diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm
index e3e61766f97..beac738708e 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -389,7 +389,7 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons
attack_hand(A)
/obj/item/attack_ai(mob/user as mob)
- if(istype(src.loc, /obj/item/robot_module))
+ if(istype(loc, /obj/item/robot_module))
// If the item is part of a cyborg module, equip it
if(!isrobot(user))
return
@@ -1022,7 +1022,7 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons
return FALSE
// Only matches and cigars can light fancy smokables.
- if(cig.fancy && !istype(src, /obj/item/match) && !istype(src, /obj/item/lighter/zippo))
+ if(length(cig.fancy_lighters) && !is_type_in_list(src, cig.fancy_lighters))
to_chat(user, "[cig] straight out REFUSES to be lit by such uncivilized means!")
return FALSE
diff --git a/code/game/objects/items/weapons/cards_ids.dm b/code/game/objects/items/weapons/cards_ids.dm
index 741357eb01c..1769bd7ff6a 100644
--- a/code/game/objects/items/weapons/cards_ids.dm
+++ b/code/game/objects/items/weapons/cards_ids.dm
@@ -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))
diff --git a/code/game/objects/items/weapons/cigs.dm b/code/game/objects/items/weapons/cigs.dm
index 7905586a559..c6e7465bf7c 100644
--- a/code/game/objects/items/weapons/cigs.dm
+++ b/code/game/objects/items/weapons/cigs.dm
@@ -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, "You put [src] into your mouth.")
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, "You need to dry this first!")
return
-
+
return ..()
/obj/item/clothing/mask/cigarette/pipe/cobpipe
diff --git a/code/game/objects/items/weapons/handcuffs.dm b/code/game/objects/items/weapons/handcuffs.dm
index 0f77bd6fecb..4d3826f3f3e 100644
--- a/code/game/objects/items/weapons/handcuffs.dm
+++ b/code/game/objects/items/weapons/handcuffs.dm
@@ -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
diff --git a/code/game/objects/items/weapons/lighters.dm b/code/game/objects/items/weapons/lighters.dm
index 2992f2473a8..b12c2c8a82e 100644
--- a/code/game/objects/items/weapons/lighters.dm
+++ b/code/game/objects/items/weapons/lighters.dm
@@ -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)
diff --git a/code/game/objects/items/weapons/storage/fancy.dm b/code/game/objects/items/weapons/storage/fancy.dm
index a376cf0bf0a..9d4fc1cc96a 100644
--- a/code/game/objects/items/weapons/storage/fancy.dm
+++ b/code/game/objects/items/weapons/storage/fancy.dm
@@ -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
*/
diff --git a/code/game/objects/items/weapons/storage/storage_base.dm b/code/game/objects/items/weapons/storage/storage_base.dm
index 9130e81e6f3..5cb6123a129 100644
--- a/code/game/objects/items/weapons/storage/storage_base.dm
+++ b/code/game/objects/items/weapons/storage/storage_base.dm
@@ -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)
diff --git a/code/game/objects/structures/signs.dm b/code/game/objects/structures/signs.dm
index b1b2089f6c3..7bd5ac80e09 100644
--- a/code/game/objects/structures/signs.dm
+++ b/code/game/objects/structures/signs.dm
@@ -9,6 +9,7 @@
flags_2 = RAD_PROTECT_CONTENTS_2 | RAD_NO_CONTAMINATE_2
blocks_emissive = EMISSIVE_BLOCK_GENERIC
var/does_emissive = FALSE
+ var/removable = TRUE
/obj/structure/sign/Initialize(mapload)
. = ..()
@@ -36,7 +37,7 @@
playsound(loc, 'sound/items/welder.ogg', 80, TRUE)
/obj/structure/sign/screwdriver_act(mob/user, obj/item/I)
- if(istype(src, /obj/structure/sign/double))
+ if(!removable)
return
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
@@ -85,6 +86,9 @@
to_chat(user, "You fasten [S] with your [I].")
qdel(src)
+/obj/structure/sign/double
+ removable = FALSE
+
/obj/structure/sign/double/map
name = "station map"
desc = "A framed picture of the station."
diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm
index c334b2bc4a7..6556a100f30 100644
--- a/code/game/objects/structures/tables_racks.dm
+++ b/code/game/objects/structures/tables_racks.dm
@@ -43,6 +43,7 @@
var/minimum_env_smash = ENVIRONMENT_SMASH_WALLS
/// Can this table be flipped?
var/can_be_flipped = TRUE
+ var/flipped_table_icon_base = "table"
/obj/structure/table/Initialize(mapload)
. = ..()
@@ -78,19 +79,7 @@
type++
if(type == 1)
subtype = direction == turn(dir,90) ? "-" : "+"
- var/base = "table"
- if(istype(src, /obj/structure/table/wood))
- base = "wood"
- if(istype(src, /obj/structure/table/reinforced))
- base = "rtable"
- if(istype(src, /obj/structure/table/wood/poker))
- base = "poker"
- if(istype(src, /obj/structure/table/wood/fancy))
- base = "fancy"
- if(istype(src, /obj/structure/table/wood/fancy/black))
- base = "fancyblack"
-
- icon_state = "[base]flip[type][type == 1 ? subtype : ""]"
+ icon_state = "[flipped_table_icon_base]flip[type][type == 1 ? subtype : ""]"
/obj/structure/table/proc/update_smoothing()
if((smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) && !flipped)
@@ -101,7 +90,7 @@
clear_smooth_overlays()
// Need to override this to allow flipped tables to be mapped in without the smoothing subsystem resetting the icon_state
-/obj/structure/table/set_smoothed_icon_state(new_junction)
+/obj/structure/table/set_smoothed_icon_state(new_junction)
if(flipped)
return
..()
@@ -650,6 +639,7 @@
icon = 'icons/obj/smooth_structures/tables/wood_table.dmi'
icon_state = "wood_table-0"
base_icon_state = "wood_table"
+ flipped_table_icon_base = "wood"
frame = /obj/structure/table_frame/wood
framestack = /obj/item/stack/sheet/wood
buildstack = /obj/item/stack/sheet/wood
@@ -669,6 +659,7 @@
icon = 'icons/obj/smooth_structures/tables/poker_table.dmi'
icon_state = "poker_table-0"
base_icon_state = "poker_table"
+ flipped_table_icon_base = "poker"
buildstack = /obj/item/stack/tile/carpet
/obj/structure/table/wood/poker/narsie_act()
@@ -684,6 +675,7 @@
icon = 'icons/obj/smooth_structures/tables/fancy/fancy_table.dmi'
icon_state = "fancy_table-0"
base_icon_state = "fancy_table"
+ flipped_table_icon_base = "fancy"
frame = /obj/structure/table_frame
framestack = /obj/item/stack/rods
buildstack = /obj/item/stack/tile/carpet
@@ -700,6 +692,7 @@
/obj/structure/table/wood/fancy/black
icon_state = "fancy_table_black-0"
base_icon_state = "fancy_table_black"
+ flipped_table_icon_base = "fancyblack"
buildstack = /obj/item/stack/tile/carpet/black
icon = 'icons/obj/smooth_structures/tables/fancy/fancy_table_black.dmi'
@@ -762,6 +755,7 @@
icon = 'icons/obj/smooth_structures/tables/reinforced_table.dmi'
icon_state = "reinforced_table-0"
base_icon_state = "reinforced_table"
+ flipped_table_icon_base = "rtables"
deconstruction_ready = FALSE
buildstack = /obj/item/stack/sheet/plasteel
smoothing_groups = list(SMOOTH_GROUP_REINFORCED_TABLES)
diff --git a/code/modules/atmospherics/machinery/atmospherics.dm b/code/modules/atmospherics/machinery/atmospherics.dm
index 44bff7a7d01..22f8ba3ec19 100644
--- a/code/modules/atmospherics/machinery/atmospherics.dm
+++ b/code/modules/atmospherics/machinery/atmospherics.dm
@@ -197,7 +197,7 @@ Pipelines + Other Objects -> Pipe network
if(!can_unwrench)
return FALSE
. = TRUE
- if(level == 1 && T.transparent_floor && istype(src, /obj/machinery/atmospherics/pipe))
+ if(wrench_floor_check())
to_chat(user, "You can't interact with something that's under the floor!")
return
if(level == 1 && isturf(T) && T.intact)
@@ -249,6 +249,12 @@ Pipelines + Other Objects -> Pipe network
unsafe_pressure_release(user,internal_pressure)
deconstruct(TRUE)
+/**
+ * This proc is to tell if an atmospheric device is in a state that should be unwrenchable because its under the floor.
+ **/
+/obj/machinery/atmospherics/proc/wrench_floor_check()
+ return FALSE
+
//(De)construction
/obj/machinery/atmospherics/attackby(obj/item/W, mob/user)
var/turf/T = get_turf(src)
diff --git a/code/modules/atmospherics/machinery/pipes/pipe.dm b/code/modules/atmospherics/machinery/pipes/pipe.dm
index f820852aab1..9fcf304fa17 100644
--- a/code/modules/atmospherics/machinery/pipes/pipe.dm
+++ b/code/modules/atmospherics/machinery/pipes/pipe.dm
@@ -44,6 +44,10 @@
/obj/machinery/atmospherics/pipe/returnPipenet(obj/machinery/atmospherics/A)
return parent
+/obj/machinery/atmospherics/pipe/wrench_floor_check()
+ var/turf/T = get_turf(src)
+ return level == 1 && T.transparent_floor
+
/obj/machinery/atmospherics/pipe/examine(mob/user)
. = ..()
. += "This pipe can be disconnected from a pipenet using a wrench. If the pipe's pressure is too high, you'll end up flying."
diff --git a/code/modules/awaymissions/mission_code/ghost_role_spawners/golems.dm b/code/modules/awaymissions/mission_code/ghost_role_spawners/golems.dm
index bc23091f65c..f8d301fa93c 100644
--- a/code/modules/awaymissions/mission_code/ghost_role_spawners/golems.dm
+++ b/code/modules/awaymissions/mission_code/ghost_role_spawners/golems.dm
@@ -175,33 +175,39 @@
return
if(QDELETED(src) || uses <= 0 || user.stat >= 1 || QDELETED(I))
return
- if(istype(src, /obj/effect/mob_spawn/human/alive/golem/servant) && !isgolem(user))
+ handle_becoming_golem(I, user)
+
+/obj/effect/mob_spawn/human/alive/golem/proc/handle_becoming_golem(obj/item/I, mob/living/carbon/user)
+ if(isgolem(user) && can_transfer)
+ var/datum/species/golem/g = user.dna.species
+ if(g.owner)
+ has_owner = TRUE
+ owner = g.owner
+ else
has_owner = FALSE
- if(isgolem(user) && can_transfer)
- var/datum/species/golem/g = user.dna.species
- if(g.owner)
- has_owner = TRUE
- owner = g.owner
- else
- has_owner = FALSE
- owner = null
- flavour_text = null
- user.visible_message("As [user] applies the potion on the golem shell, a faint light leaves them, moving to [src] and animating it!",
- "You apply the potion to [src], feeling your mind leave your body!")
- message_admins("[key_name(user)] used [I] to transfer their mind into [src]")
- var/mob/living/carbon/human/g = create() //Create the golem and prep mind transfer stuff
- user.mind.transfer_to(g)
- g.real_name = user.real_name
- g.faction = user.faction
- user.death() //Keeps brain intact to prevent forcing redtext
- to_chat(g, "You have become the [g.dna.species]. Your allegiances, alliances, and roles are still the same as they were prior to using [I]!")
- qdel(I)
+ owner = null
+ flavour_text = null
+ user.visible_message("As [user] applies the potion on the golem shell, a faint light leaves them, moving to [src] and animating it!",
+ "You apply the potion to [src], feeling your mind leave your body!")
+ message_admins("[key_name(user)] used [I] to transfer their mind into [src]")
+ var/mob/living/carbon/human/g = create() //Create the golem and prep mind transfer stuff
+ user.mind.transfer_to(g)
+ g.real_name = user.real_name
+ g.faction = user.faction
+ user.death() //Keeps brain intact to prevent forcing redtext
+ to_chat(g, "You have become the [g.dna.species]. Your allegiances, alliances, and roles are still the same as they were prior to using [I]!")
+ qdel(I)
/obj/effect/mob_spawn/human/alive/golem/servant
has_owner = TRUE
name = "inert servant golem shell"
mob_name = "a servant golem"
+/obj/effect/mob_spawn/human/alive/golem/servant/handle_becoming_golem(obj/item/I, mob/living/carbon/user)
+ if(!isgolem(user))
+ has_owner = FALSE
+ return ..()
+
/obj/effect/mob_spawn/human/alive/golem/adamantine
name = "dust-caked free golem shell"
desc = "A humanoid shape, empty, lifeless, and full of potential."
diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm
index b2b560a4b7a..50f1ef7d08a 100644
--- a/code/modules/clothing/clothing.dm
+++ b/code/modules/clothing/clothing.dm
@@ -168,25 +168,11 @@
if(!usr.canUnEquip(src))
return
- var/obj/item/clothing/ears/O
- if(slot_flags & SLOT_FLAG_TWOEARS)
- O = (H.l_ear == src ? H.r_ear : H.l_ear)
- user.unEquip(O)
- if(!istype(src, /obj/item/clothing/ears/offear))
- qdel(O)
- O = src
- else
- O = src
-
user.unEquip(src)
- if(O)
- user.put_in_hands(O)
- O.add_fingerprint(user)
-
- if(istype(src, /obj/item/clothing/ears/offear))
- qdel(src)
-
+ if(src)
+ user.put_in_hands(src)
+ add_fingerprint(user)
/obj/item/clothing/ears/offear
name = "Other ear"
diff --git a/code/modules/hydroponics/hydroponics_tray.dm b/code/modules/hydroponics/hydroponics_tray.dm
index 0c0f799fdbc..538094feb47 100644
--- a/code/modules/hydroponics/hydroponics_tray.dm
+++ b/code/modules/hydroponics/hydroponics_tray.dm
@@ -74,6 +74,8 @@
/// What do we call the mutagen tank?
var/mutagen_tank_name = "Mutagen tank"
+ var/is_soil = FALSE
+
/obj/machinery/hydroponics/Initialize(mapload)
. = ..()
var/datum/atom_hud/data/hydroponic/hydro_hud = GLOB.huds[DATA_HUD_HYDROPONIC]
@@ -303,7 +305,7 @@
/obj/machinery/hydroponics/proc/update_state()
//Refreshes the icon and sets the luminosity
if(self_sustaining)
- if(istype(src, /obj/machinery/hydroponics/soil))
+ if(is_soil)
color = rgb(255, 175, 0)
set_light(3)
else
@@ -322,7 +324,7 @@
/obj/machinery/hydroponics/update_overlays()
. = ..()
- if(self_sustaining && !istype(src, /obj/machinery/hydroponics/soil))
+ if(self_sustaining && !is_soil)
. += "gaia_blessing"
if(lid_closed)
@@ -1019,6 +1021,7 @@
power_state = NO_POWER_USE
wrenchable = FALSE
mutagen_tank_name = "Mutagen pool"
+ is_soil = TRUE
/obj/machinery/hydroponics/soil/update_icon_state()
return // Has no hoses
diff --git a/code/modules/mob/living/carbon/human/human_mob.dm b/code/modules/mob/living/carbon/human/human_mob.dm
index d8d677fac28..3a60dd0fa12 100644
--- a/code/modules/mob/living/carbon/human/human_mob.dm
+++ b/code/modules/mob/living/carbon/human/human_mob.dm
@@ -769,13 +769,13 @@
///Checked in life.dm. 0 & 1 = no impairment, 2 = welding mask overlay, 3 = You can see jack, but you can't see shit.
/mob/living/carbon/human/tintcheck()
var/tinted = 0
- if(istype(src.head, /obj/item/clothing/head))
+ if(istype(head, /obj/item/clothing/head))
var/obj/item/clothing/head/HT = src.head
tinted += HT.tint
- if(istype(src.glasses, /obj/item/clothing/glasses))
+ if(istype(glasses, /obj/item/clothing/glasses))
var/obj/item/clothing/glasses/GT = src.glasses
tinted += GT.tint
- if(istype(src.wear_mask, /obj/item/clothing/mask))
+ if(istype(wear_mask, /obj/item/clothing/mask))
var/obj/item/clothing/mask/MT = src.wear_mask
tinted += MT.tint
diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm
index 45717aef732..98af30e9d07 100644
--- a/code/modules/mob/living/living.dm
+++ b/code/modules/mob/living/living.dm
@@ -391,8 +391,7 @@
temperature -= change
if(actual < desired)
temperature = desired
-// if(istype(src, /mob/living/carbon/human))
-// to_chat(world, "[src] ~ [bodytemperature] ~ [temperature]")
+
return temperature
diff --git a/code/modules/mob/living/simple_animal/bot/bot_construction.dm b/code/modules/mob/living/simple_animal/bot/bot_construction.dm
index d73819b6475..c302b3bd39f 100644
--- a/code/modules/mob/living/simple_animal/bot/bot_construction.dm
+++ b/code/modules/mob/living/simple_animal/bot/bot_construction.dm
@@ -252,7 +252,7 @@
if(!istype(T, /obj/item/stack/tile/plasteel))
..()
return
- if(!istype(src, /obj/item/storage/toolbox))
+ if(QDELETED(src))
return
if(length(contents) >= 1)
to_chat(user, "They won't fit in, as there is already stuff inside.")
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index fde5e123e6b..827f24c121e 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -505,7 +505,7 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
if(!disable_warning)
to_chat(usr, "The [name] is too big to attach.")
return 0
- if(istype(src, /obj/item/pda) || is_pen(src) || is_type_in_list(src, H.wear_suit.allowed))
+ if(is_pda(src) || is_pen(src) || is_type_in_list(src, H.wear_suit.allowed))
if(H.s_store)
if(!(H.s_store.flags & NODROP))
return 2
@@ -517,15 +517,11 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
if(SLOT_HUD_HANDCUFFED)
if(H.handcuffed)
return 0
- if(!istype(src, /obj/item/restraints/handcuffs))
- return 0
- return 1
+ return istype(src, /obj/item/restraints/handcuffs)
if(SLOT_HUD_LEGCUFFED)
if(H.legcuffed)
return 0
- if(!istype(src, /obj/item/restraints/legcuffs))
- return 0
- return 1
+ return istype(src, /obj/item/restraints/legcuffs)
if(SLOT_HUD_IN_BACKPACK)
if(H.back && istype(H.back, /obj/item/storage/backpack))
var/obj/item/storage/backpack/B = H.back
diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm
index b378ab4d42b..de78f0566fb 100644
--- a/code/modules/paperwork/photography.dm
+++ b/code/modules/paperwork/photography.dm
@@ -377,10 +377,8 @@ GLOBAL_LIST_INIT(SpookyGhosts, list("ghost","shade","shade2","ghost-narsie","hor
icon_state = icon_off
on = FALSE
on_cooldown = TRUE
- if(istype(src,/obj/item/camera/spooky))
- if(user.mind && user.mind.assigned_role == "Chaplain" && see_ghosts)
- if(prob(24))
- handle_haunt(user)
+
+ handle_haunt(user)
addtimer(CALLBACK(src, PROC_REF(reset_cooldown)), 6.4 SECONDS) // fucking magic numbers
/obj/item/camera/proc/reset_cooldown()
@@ -427,7 +425,7 @@ GLOBAL_LIST_INIT(SpookyGhosts, list("ghost","shade","shade2","ghost-narsie","hor
pc.Blend(tiny_img,ICON_OVERLAY, 12, 19)
var/datum/picture/P = new()
- if(istype(src,/obj/item/camera/digital))
+ if(digital)
P.fields["name"] = tgui_input_text(user, "Name photo:", "Photo", encode = FALSE)
if(!P.fields["name"])
P.fields["name"] = "Photo [current_photo_num]"
@@ -641,13 +639,17 @@ GLOBAL_LIST_INIT(SpookyGhosts, list("ghost","shade","shade2","ghost-narsie","hor
///hauntings, like hallucinations but more spooky
-/obj/item/camera/proc/handle_haunt(mob/user as mob)
- var/list/creepyasssounds = list('sound/effects/ghost.ogg', 'sound/effects/ghost2.ogg', 'sound/effects/heartbeat.ogg', 'sound/effects/screech.ogg',\
- 'sound/hallucinations/behind_you1.ogg', 'sound/hallucinations/behind_you2.ogg', 'sound/hallucinations/far_noise.ogg', 'sound/hallucinations/growl1.ogg', 'sound/hallucinations/growl2.ogg',\
- 'sound/hallucinations/growl3.ogg', 'sound/hallucinations/im_here1.ogg', 'sound/hallucinations/im_here2.ogg', 'sound/hallucinations/i_see_you1.ogg', 'sound/hallucinations/i_see_you2.ogg',\
- 'sound/hallucinations/look_up1.ogg', 'sound/hallucinations/look_up2.ogg', 'sound/hallucinations/over_here1.ogg', 'sound/hallucinations/over_here2.ogg', 'sound/hallucinations/over_here3.ogg',\
- 'sound/hallucinations/turn_around1.ogg', 'sound/hallucinations/turn_around2.ogg', 'sound/hallucinations/veryfar_noise.ogg', 'sound/hallucinations/wail.ogg')
- user << pick(creepyasssounds)
+/obj/item/camera/proc/handle_haunt(mob/user)
+ return
+
+/obj/item/camera/spooky/handle_haunt(mob/user)
+ if(user.mind && user.mind.assigned_role == "Chaplain" && see_ghosts && prob(24))
+ var/list/creepyasssounds = list('sound/effects/ghost.ogg', 'sound/effects/ghost2.ogg', 'sound/effects/heartbeat.ogg', 'sound/effects/screech.ogg',\
+ 'sound/hallucinations/behind_you1.ogg', 'sound/hallucinations/behind_you2.ogg', 'sound/hallucinations/far_noise.ogg', 'sound/hallucinations/growl1.ogg', 'sound/hallucinations/growl2.ogg',\
+ 'sound/hallucinations/growl3.ogg', 'sound/hallucinations/im_here1.ogg', 'sound/hallucinations/im_here2.ogg', 'sound/hallucinations/i_see_you1.ogg', 'sound/hallucinations/i_see_you2.ogg',\
+ 'sound/hallucinations/look_up1.ogg', 'sound/hallucinations/look_up2.ogg', 'sound/hallucinations/over_here1.ogg', 'sound/hallucinations/over_here2.ogg', 'sound/hallucinations/over_here3.ogg',\
+ 'sound/hallucinations/turn_around1.ogg', 'sound/hallucinations/turn_around2.ogg', 'sound/hallucinations/veryfar_noise.ogg', 'sound/hallucinations/wail.ogg')
+ SEND_SOUND(user, pick(creepyasssounds))
/obj/item/camera/proc/build_composite_icon(atom/A)
diff --git a/code/modules/power/engines/supermatter/supermatter.dm b/code/modules/power/engines/supermatter/supermatter.dm
index 366273e4bfe..8e2c20709c0 100644
--- a/code/modules/power/engines/supermatter/supermatter.dm
+++ b/code/modules/power/engines/supermatter/supermatter.dm
@@ -391,10 +391,7 @@
if(T)
var/obj/singularity/energy_ball/E = new(T)
E.energy = 200 //Gets us about 9 balls
-// else if(power > EVENT_POWER_PENALTY_THRESHOLD && prob(power/50) && !istype(src, /obj/machinery/atmospherics/supermatter_crystal/shard))
-// var/datum/round_event_control/crystal_invasion/crystals = new/datum/round_event_control/crystal_invasion
-// crystals.runEvent()
-// return //No boom for me sir
+
//Dear mappers, balance the sm max explosion radius to 17.5, 37, 39, 41
if(forced_gasmix_power_ratio)
gasmix_power_ratio = forced_gasmix_power_ratio
diff --git a/code/modules/projectiles/guns/projectile/revolver.dm b/code/modules/projectiles/guns/projectile/revolver.dm
index 38b5c4a3aa5..3b7a9248989 100644
--- a/code/modules/projectiles/guns/projectile/revolver.dm
+++ b/code/modules/projectiles/guns/projectile/revolver.dm
@@ -500,16 +500,6 @@
else
return ..()
-/obj/item/gun/projectile/revolver/doublebarrel/improvised/cane/examine(mob/user) // HAD TO REPEAT EXAMINE CODE BECAUSE GUN CODE DOESNT STEALTH
- var/f_name = "\a [src]."
- if(blood_DNA && !istype(src, /obj/effect/decal))
- if(gender == PLURAL)
- f_name = "some "
- else
- f_name = "a "
- f_name += "blood-stained [name]!"
-
- . = list("[bicon(src)] That's [f_name]")
-
- if(desc)
- . += desc
+/obj/item/gun/projectile/revolver/doublebarrel/improvised/cane/examine(mob/user)
+ // So that it is stealthy
+ return build_base_description()
diff --git a/code/modules/surgery/organs/organ_external.dm b/code/modules/surgery/organs/organ_external.dm
index 9bc5f4aa2c9..623ce326cb2 100644
--- a/code/modules/surgery/organs/organ_external.dm
+++ b/code/modules/surgery/organs/organ_external.dm
@@ -601,8 +601,6 @@ Note that amputating the affected organ does in fact remove the infection from t
if(!disintegrate)
disintegrate = DROPLIMB_SHARP
- if(disintegrate == DROPLIMB_BURN && istype(src, /obj/item/organ/external/head))
- disintegrate = DROPLIMB_SHARP //Lets not make sharp burn weapons delete brains.
switch(disintegrate)
if(DROPLIMB_SHARP)
diff --git a/code/modules/surgery/organs/subtypes/standard_organs.dm b/code/modules/surgery/organs/subtypes/standard_organs.dm
index bba265b2537..a8f5ab690fb 100644
--- a/code/modules/surgery/organs/subtypes/standard_organs.dm
+++ b/code/modules/surgery/organs/subtypes/standard_organs.dm
@@ -264,6 +264,10 @@
/obj/item/organ/external/head/vars_to_save()
return list("color", "name", "h_grad_style", "h_grad_offset_x", "h_grad_offset_y", "h_grad_colour", "h_grad_alpha")
+/obj/item/organ/external/head/droplimb(clean, disintegrate, ignore_children, nodamage)
+ disintegrate = DROPLIMB_SHARP // Lets make sure to not delete brains
+ return ..(clean, disintegrate, ignore_children, nodamage)
+
/obj/item/organ/external/head/remove()
if(owner)
if(!istype(dna))
diff --git a/tools/ci/check_grep2.py b/tools/ci/check_grep2.py
index a6365d8df9b..cb3cbcb5baf 100644
--- a/tools/ci/check_grep2.py
+++ b/tools/ci/check_grep2.py
@@ -176,6 +176,11 @@ def check_manual_icon_updates(idx, line):
target = "update_appearance"
return [(idx + 1, f"{proc_result}() should not be called manually. Use {target}({proc_result.upper()}) instead.")]
+CONDITIONAL_ISTYPE_SRC = re.compile(r"if.+istype\(src,\s?\/[^turf]")
+def check_istype_src(idx, line):
+ if CONDITIONAL_ISTYPE_SRC.search(line):
+ return [(idx + 1, "Our coding requirements prohibit use of istype(src, /any_type). Consider making the behavior dependent on a variable and/or overriding a proc instead.")]
+
CODE_CHECKS = [
check_space_indentation,
check_mixed_indentation,
@@ -191,6 +196,7 @@ CODE_CHECKS = [
check_href_styles,
check_initialize_missing_mapload,
check_empty_list_whitespace,
+ check_istype_src,
]