Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor Code Maintenance Bundle (deletes, standards, runtimes) #4756

Merged
merged 7 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions code/game/objects/effects/spawners/random.dm
Original file line number Diff line number Diff line change
Expand Up @@ -351,29 +351,28 @@

/obj/effect/spawner/random/gun/proc/spawn_weapon_on_floor(gunpath, ammopath, ammo_amount = 1)

var/atom/spawnloc = src
spawnloc = get_turf(spawnloc)
var/turf/spawnloc = get_turf(src)
var/obj/gun
var/obj/ammo

if(gunpath)
gun = new gunpath(spawnloc)
if(scatter)
var/direction = pick(alldirs)
var/turf/T = get_step(gun, direction)
if(!T || T.density)
var/turf/turf = get_step(gun, direction)
if(!turf || turf.density)
return
gun.loc = T
gun.forceMove(turf)
if(ammopath)
for(var/i in 0 to ammo_amount-1)
ammo = new ammopath(spawnloc)
if(scatter)
for(i=0, i<rand(1,3), i++)
var/direction = pick(alldirs)
var/turf/T = get_step(ammo, direction)
if(!T || T.density)
var/turf/turf = get_step(ammo, direction)
if(!turf || turf.density)
break
ammo.loc = T
ammo.forceMove(turf)

/*
// the actual spawners themselves
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/reagent_containers/glass/bottle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
/obj/item/reagent_container/glass/bottle/Initialize()
. = ..()
if(!icon_state)
icon_state = "bottle-[rand(1.4)]"
icon_state = "bottle-[rand(1,4)]"

/obj/item/reagent_container/glass/bottle/update_icon()
overlays.Cut()
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/storage/boxes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
RegisterSignal(SSdcs, COMSIG_GLOB_MODE_PRESETUP, PROC_REF(handle_delete_clash_contents))

/obj/item/storage/box/flashbangs/proc/handle_delete_clash_contents()
SIGNAL_HANDLER
if(MODE_HAS_FLAG(MODE_FACTION_CLASH))
var/grenade_count = 0
var/grenades_desired = 4
Expand Down
21 changes: 11 additions & 10 deletions code/game/objects/items/storage/storage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
var/atom/movable/screen/storage/storage_start = null //storage UI
var/atom/movable/screen/storage/storage_continue = null
var/atom/movable/screen/storage/storage_end = null
var/datum/item_storage_box/stored_ISB = null // This contains what previously was known as stored_start, stored_continue, and stored_end
var/datum/item_storage_box/stored_ISB //! This contains what previously was known as stored_start, stored_continue, and stored_end
var/atom/movable/screen/close/closer = null
var/foldable = null
var/use_sound = "rustle" //sound played when used. null for no sound.
Expand Down Expand Up @@ -212,16 +212,17 @@
if (storage_flags & STORAGE_SHOW_FULLNESS)
boxes.update_fullness(src)

var/list/global/item_storage_box_cache = list()
GLOBAL_LIST_EMPTY_TYPED(item_storage_box_cache, /datum/item_storage_box)

/datum/item_storage_box
var/atom/movable/screen/storage/start = null
var/atom/movable/screen/storage/continued = null
var/atom/movable/screen/storage/end = null
/// The index that indentifies me inside item_storage_box_cache
var/atom/movable/screen/storage/start
var/atom/movable/screen/storage/continued
var/atom/movable/screen/storage/end
/// The index that indentifies me inside GLOB.item_storage_box_cache
var/index

/datum/item_storage_box/New()
. = ..()
start = new()
start.icon_state = "stored_start"
continued = new()
Expand All @@ -233,7 +234,7 @@ var/list/global/item_storage_box_cache = list()
QDEL_NULL(start)
QDEL_NULL(continued)
QDEL_NULL(end)
item_storage_box_cache[index] = null // Or would it be better to -= src?
GLOB.item_storage_box_cache -= index
return ..()

/obj/item/storage/proc/space_orient_objs(list/obj/item/display_contents)
Expand Down Expand Up @@ -271,7 +272,7 @@ var/list/global/item_storage_box_cache = list()
click_border_start.Add(startpoint)
click_border_end.Add(endpoint)

if(!item_storage_box_cache[isb_index])
if(!GLOB.item_storage_box_cache[isb_index])
var/datum/item_storage_box/box = new()
var/matrix/M_start = matrix()
var/matrix/M_continue = matrix()
Expand All @@ -284,9 +285,9 @@ var/list/global/item_storage_box_cache = list()
box.continued.apply_transform(M_continue)
box.end.apply_transform(M_end)
box.index = isb_index
item_storage_box_cache[isb_index] = box
GLOB.item_storage_box_cache[isb_index] = box

var/datum/item_storage_box/ISB = item_storage_box_cache[isb_index]
var/datum/item_storage_box/ISB = GLOB.item_storage_box_cache[isb_index]
stored_ISB = ISB

storage_start.overlays += ISB.start
Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/structures/flora.dm
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ PLANT_CUT_MACHETE = 3 = Needs at least a machete to be cut down
addtimer(CALLBACK(src, PROC_REF(burn_up)), spread_time + 5 SECONDS)

/obj/structure/flora/proc/spread_fire()
SIGNAL_HANDLER
for(var/D in cardinal) //Spread fire
var/turf/T = get_step(src.loc, D)
if(T)
Expand All @@ -82,6 +83,7 @@ PLANT_CUT_MACHETE = 3 = Needs at least a machete to be cut down
new /obj/flamer_fire(T, create_cause_data("wildfire"))

/obj/structure/flora/proc/burn_up()
SIGNAL_HANDLER
new /obj/effect/decal/cleanable/dirt(loc)
if(center)
new /obj/effect/decal/cleanable/dirt(loc) //Produces more ash at the center
Expand Down
7 changes: 4 additions & 3 deletions code/modules/cm_marines/smartgun_mount.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@
var/rounds = 0 // How many rounds are in the weapon. This is useful if we break down our guns.
var/has_mount = FALSE // Indicates whether the M56D will come with its folding mount already attached

/obj/item/device/m56d_gun/New()
..()

/obj/item/device/m56d_gun/Initialize(mapload, ...)
. = ..()
update_icon()

/obj/item/device/m56d_gun/get_examine_text(mob/user) //Let us see how much ammo we got in this thing.
Expand Down Expand Up @@ -520,6 +519,8 @@
if(operator)
operator.unset_interaction()
STOP_PROCESSING(SSobj, src)
QDEL_NULL(in_chamber)
ammo = null
. = ..()

/obj/structure/machinery/m56d_hmg/get_examine_text(mob/user) //Let us see how much ammo we got in this thing.
Expand Down
6 changes: 3 additions & 3 deletions code/modules/cm_tech/implements/railgun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ GLOBAL_DATUM(railgun_eye_location, /datum/coords)
RegisterSignal(eye, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(check_and_set_zlevel))
RegisterSignal(eye, COMSIG_PARENT_QDELETING, PROC_REF(remove_current_operator))

/obj/structure/machinery/computer/railgun/proc/check_and_set_zlevel(mob/hologram/railgun/H, turf/NewLoc, direction)
/obj/structure/machinery/computer/railgun/proc/check_and_set_zlevel(mob/hologram/railgun/hologram, turf/NewLoc, direction)
SIGNAL_HANDLER
if(!start_location)
start_location = GLOB.railgun_eye_location.get_turf_from_coord()

if(!NewLoc || (NewLoc.z != target_z && H.z != target_z))
H.loc = start_location
if(!NewLoc || (NewLoc.z != target_z && hologram.z != target_z))
hologram.forceMove(start_location)
return COMPONENT_OVERRIDE_MOVE

/obj/structure/machinery/computer/railgun/proc/can_fire(mob/living/carbon/human/H, turf/T)
Expand Down
2 changes: 0 additions & 2 deletions code/modules/gear_presets/cmb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,6 @@
new_human.equip_to_slot_or_del(new /obj/item/storage/pouch/construction/full, WEAR_R_STORE)
new_human.equip_to_slot_or_del(new /obj/item/storage/pouch/firstaid/ert, WEAR_L_STORE)

new_human.back.pickup()

//Anchorpoint Station Corpsman
/datum/equipment_preset/uscm/cmb/medic
name = "USCM Anchorpoint Station Corpsman"
Expand Down
2 changes: 0 additions & 2 deletions code/modules/gear_presets/uscm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -780,8 +780,6 @@
new_human.equip_to_slot_or_del(new /obj/item/storage/pouch/general/large(new_human), WEAR_R_STORE)
new_human.equip_to_slot_or_del(new /obj/item/device/binoculars(new_human), WEAR_L_HAND)

new_human.back.pickup()
Drulikar marked this conversation as resolved.
Show resolved Hide resolved

/datum/equipment_preset/uscm/tl_equipped/cryo
name = "USCM Cryo Fireteam Leader (Equipped)"
auto_squad_name = SQUAD_MARINE_CRYO
Expand Down
5 changes: 3 additions & 2 deletions code/modules/mob/dead/observer/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,11 @@
if(observe_target_mob)
clean_observe_target()

/mob/dead/observer/Destroy()
/mob/dead/observer/Destroy(force)
GLOB.observer_list -= src
QDEL_NULL(orbit_menu)
QDEL_NULL(last_health_display)
GLOB.observer_list -= src
QDEL_NULL(minimap)
following = null
observe_target_mob = null
observe_target_client = null
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/xenomorph/Embryo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
victim.pain.apply_pain(PAIN_CHESTBURST_STRONG) //ow that really hurts larvie!
var/message = SPAN_HIGHDANGER( pick("IT'S IN YOUR INSIDES!", "IT'S GNAWING YOU!", "MAKE IT STOP!", "YOU ARE GOING TO DIE!", "IT'S TEARING YOU APART!"))
to_chat(victim, message)
addtimer(CALLBACK(src, PROC_REF(cause_unbearable_pain), victim), rand(1, 3) SECONDS, TIMER_UNIQUE)
addtimer(CALLBACK(src, PROC_REF(cause_unbearable_pain), victim), rand(1, 3) SECONDS, TIMER_UNIQUE|TIMER_NO_HASH_WAIT)

/mob/living/carbon/xenomorph/larva/proc/chest_burst(mob/living/carbon/victim)
set waitfor = 0
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/xenomorph/Xenomorph.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@
if(length(resin_build_order))
selected_resin = resin_build_order[1]

/mob/living/carbon/xenomorph/ghostize(can_reenter_corpse = TRUE)
/mob/living/carbon/xenomorph/ghostize(can_reenter_corpse = TRUE, aghosted = FALSE)
. = ..()
if(. && !can_reenter_corpse && stat != DEAD && !QDELETED(src) && !is_admin_level(z))
handle_ghost_message()
Expand Down
9 changes: 6 additions & 3 deletions code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@
GLOB.player_list -= src
GLOB.freed_mob_list -= src

var/datum/mind/old_mind = mind
ghostize(FALSE)

item_verbs = null
control_object = null

if(mind) // Means ghostize failed for some reason
if(mind.current == src)
mind.current = null
if(mind.original == src)
mind.original = null
mind = null
else if(old_mind?.original == src) // If ghostize succeeded, unlink original mob
old_mind.original = null

item_verbs = null
control_object = null

QDEL_NULL(skills)
QDEL_NULL_LIST(actions)
Expand Down
7 changes: 1 addition & 6 deletions code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -287,16 +287,11 @@
/obj/item/weapon/gun/Destroy()
in_chamber = null
ammo = null
current_mag = null
QDEL_NULL(current_mag)
target = null
last_moved_mob = null
if(flags_gun_features & GUN_FLASHLIGHT_ON)//Handle flashlight.
flags_gun_features &= ~GUN_FLASHLIGHT_ON
if(ismob(loc))
for(var/slot in attachments)
var/obj/item/attachable/potential_attachment = attachments[slot]
if(!potential_attachment)
continue
attachments = null
attachable_overlays = null
QDEL_NULL(active_attachable)
Expand Down