Skip to content

Commit

Permalink
Assorted runtime fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
Absolucy committed Feb 26, 2024
1 parent 5645a58 commit 3e1d7cf
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 38 deletions.
4 changes: 4 additions & 0 deletions code/datums/chatmessage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@
///finishes the image generation after the MeasureText() call in generate_image().
///necessary because after that call the proc can resume at the end of the tick and cause overtime.
/datum/chatmessage/proc/finish_image_generation(mheight, atom/target, mob/owner, complete_text, lifespan)
// If client is gone, then we just clean ourselves up.
if(QDELETED(owned_by))
qdel(src)
return
var/rough_time = REALTIMEOFDAY
approx_lines = max(1, mheight / CHAT_MESSAGE_APPROX_LHEIGHT)

Expand Down
10 changes: 5 additions & 5 deletions code/modules/admin/smites/boneless.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
var/mob/living/carbon/carbon_target = target
for(var/obj/item/bodypart/limb as anything in carbon_target.bodyparts)
var/severity = pick(list(
"[WOUND_SEVERITY_MODERATE]",
"[WOUND_SEVERITY_SEVERE]",
"[WOUND_SEVERITY_SEVERE]",
"[WOUND_SEVERITY_CRITICAL]",
"[WOUND_SEVERITY_CRITICAL]",
WOUND_SEVERITY_MODERATE,
WOUND_SEVERITY_SEVERE,
WOUND_SEVERITY_SEVERE,
WOUND_SEVERITY_CRITICAL,
WOUND_SEVERITY_CRITICAL,
))
carbon_target.cause_wound_of_type_and_severity(WOUND_BLUNT, limb, severity)
3 changes: 1 addition & 2 deletions code/modules/mob/dead/new_player/login.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,5 @@
var/tl = SSticker.GetTimeLeft()
to_chat(src, "Please set up your character and select \"Ready\". The game will start [tl > 0 ? "in about [DisplayTimeText(tl)]" : "soon"].")


spawn(4 SECONDS)
client.playtitlemusic()
client?.playtitlemusic()
19 changes: 10 additions & 9 deletions code/modules/mob/inventory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
return FALSE

/mob/proc/can_put_in_hand(I, hand_index)
if(hand_index > held_items.len)
if(hand_index > length(held_items))
return FALSE
if(!put_in_hand_check(I))
return FALSE
Expand All @@ -153,7 +153,7 @@
return !held_items[hand_index]

/mob/proc/put_in_hand(obj/item/I, hand_index, forced = FALSE, ignore_anim = TRUE)
if(hand_index == null || !held_items.len || (!forced && !can_put_in_hand(I, hand_index)))
if(hand_index == null || !length(held_items) || (!forced && !can_put_in_hand(I, hand_index)))
return FALSE

if(isturf(I.loc) && !ignore_anim)
Expand Down Expand Up @@ -260,7 +260,7 @@
//Here lie drop_from_inventory and before_item_take, already forgotten and not missed.

/mob/proc/canUnEquip(obj/item/I, force)
if(!I)
if(QDELETED(I))
return TRUE
if(HAS_TRAIT(I, TRAIT_NODROP) && !force)
return FALSE
Expand All @@ -286,13 +286,13 @@
* If the item can be dropped, it will be forceMove()'d to the ground and the turf's Entered() will be called.
*/
/mob/proc/dropItemToGround(obj/item/I, force = FALSE, silent = FALSE, invdrop = TRUE)
if (isnull(I))
if(QDELETED(I))
return TRUE

SEND_SIGNAL(src, COMSIG_MOB_DROPPING_ITEM)
. = doUnEquip(I, force, drop_location(), FALSE, invdrop = invdrop, silent = silent)

if(!. || !I) //ensure the item exists and that it was dropped properly.
if(!. || QDELETED(I)) //ensure the item exists and that it was dropped properly.
return

if(!(I.item_flags & NO_PIXEL_RANDOM_DROP))
Expand All @@ -303,7 +303,8 @@
//for when the item will be immediately placed in a loc other than the ground
/mob/proc/transferItemToLoc(obj/item/I, newloc = null, force = FALSE, silent = TRUE)
. = doUnEquip(I, force, newloc, FALSE, silent = silent)
I.do_drop_animation(src)
if(!QDELETED(I)) // since some items do in fact delete themselves on unequip
I.do_drop_animation(src)

//visibly unequips I but it is NOT MOVED AND REMAINS IN SRC
//item MUST BE FORCEMOVE'D OR QDEL'D
Expand All @@ -317,7 +318,7 @@
//Use no_move if the item is just gonna be immediately moved afterward
//Invdrop is used to prevent stuff in pockets dropping. only set to false if it's going to immediately be replaced
PROTECTED_PROC(TRUE)
if(!I) //If there's nothing to drop, the drop is automatically succesfull. If(unEquip) should generally be used to check for TRAIT_NODROP.
if(QDELETED(I)) //If there's nothing to drop, the drop is automatically succesfull. If(unEquip) should generally be used to check for TRAIT_NODROP.
return TRUE

if(HAS_TRAIT(I, TRAIT_NODROP) && !force)
Expand All @@ -330,7 +331,7 @@
if(hand_index)
held_items[hand_index] = null
update_held_items()
if(I)
if(!QDELETED(I))
if(client)
client.screen -= I
I.layer = initial(I.layer)
Expand All @@ -342,7 +343,7 @@
else
I.forceMove(newloc)
I.dropped(src, silent)
SEND_SIGNAL(I, COMSIG_ITEM_POST_UNEQUIP, force, newloc, no_move, invdrop, silent)
SEND_SIGNAL(I, COMSIG_ITEM_POST_UNEQUIP, force, newloc, no_move, invdrop, silent)
SEND_SIGNAL(src, COMSIG_MOB_UNEQUIPPED_ITEM, I, force, newloc, no_move, invdrop, silent)
return TRUE

Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/chemistry/reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent())
current_cycle++
if(length(reagent_removal_skip_list))
return
holder.remove_reagent(type, metabolization_rate * M.metabolism_efficiency * seconds_per_tick) //By default it slowly disappears.
holder?.remove_reagent(type, metabolization_rate * M.metabolism_efficiency * seconds_per_tick) //By default it slowly disappears.

/// Called in burns.dm *if* the reagent has the REAGENT_AFFECTS_WOUNDS process flag
/datum/reagent/proc/on_burn_wound_processing(datum/wound/burn/flesh/burn_wound)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
current_cycle++
if(length(reagent_removal_skip_list))
return
holder.remove_reagent(type, metabolization_rate * seconds_per_tick / affected_mob.metabolism_efficiency) //medicine reagents stay longer if you have a better metabolism
holder?.remove_reagent(type, metabolization_rate * seconds_per_tick / affected_mob.metabolism_efficiency) //medicine reagents stay longer if you have a better metabolism

/datum/reagent/medicine/leporazine
name = "Leporazine"
Expand Down
2 changes: 1 addition & 1 deletion monkestation/code/datums/dna.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

/datum/dna/proc/update_body_height()
var/mob/living/carbon/human/human_holder = holder
if(!istype(holder))
if(!istype(human_holder))
return
var/height = GLOB.body_heights[body_height]
if(isnull(height))
Expand Down
2 changes: 1 addition & 1 deletion monkestation/code/game/machinery/exp_cloner.dm
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,6 @@
temp = "<font class='bad'>Cloning cycle already in progress.</font>"
playsound(src, 'sound/machines/terminal_prompt_deny.ogg', 50, FALSE)
else
pod.growclone(mob_occupant.real_name, dna.unique_identity, dna.mutation_index, null, null, dna.blood_type, clone_species, dna.features, mob_occupant.faction)
pod.growclone(mob_occupant.real_name, dna.unique_identity, dna.mutation_index, null, dna.blood_type, clone_species, dna.features, mob_occupant.faction)
temp = "[mob_occupant.real_name] => <font class='good'>Cloning data sent to pod.</font>"
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, FALSE)
32 changes: 14 additions & 18 deletions monkestation/code/game/objects/items/implants/hardlight.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,16 @@

/obj/item/implant/hard_spear/implant(mob/living/target, mob/user, silent = FALSE, force = FALSE)
. = ..()
if (!.)
if (!. || !spell_to_give)
return

if (!spell_to_give)
return FALSE

var/datum/action/cooldown/spell/existing = locate(spell_to_give) in user.actions
if(existing)
if(!existing.level_spell())
to_chat(target, span_boldnotice("The implant is unable to upgrade your hardlight spear further"))
return FALSE
timerid = QDEL_IN_STOPPABLE(src, deltime)
return TRUE
if(!QDELETED(user))
var/datum/action/cooldown/spell/existing = locate(spell_to_give) in user.actions
if(existing)
if(!existing.level_spell())
to_chat(target, span_boldnotice("The implant is unable to upgrade your hardlight spear further"))
return FALSE
timerid = QDEL_IN_STOPPABLE(src, deltime)
return TRUE
spell_inside = TRUE
spell_to_give.Grant(target)
return TRUE
Expand All @@ -45,12 +42,11 @@
if (!.)
return FALSE

if(spell_inside)
if(spell_to_give)
spell_inside_level = spell_to_give.spell_level
spell_to_give.Remove(source)
if(source.stat != DEAD && !silent)
to_chat(source, span_boldnotice(""))
if(spell_inside && spell_to_give)
spell_inside_level = spell_to_give.spell_level
spell_to_give.Remove(source)
if(source.stat != DEAD && !silent)
to_chat(source, span_boldnotice(""))

if(timerid)
deltimer(timerid)
Expand Down

0 comments on commit 3e1d7cf

Please sign in to comment.