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

Fix some runtimes! #3256

Merged
merged 16 commits into from
Oct 7, 2023
6 changes: 5 additions & 1 deletion code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ Turf and target are separate in case you want to teleport some distance from a t
var/steps = 1
if(current != target_turf)
current = get_step_towards(current, target_turf)
if (!current)
return 0 // How did you get from somewhere to nowhere????
while(current != target_turf)
if(steps > length)
return 0
Expand Down Expand Up @@ -1631,13 +1633,15 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)

/// REcursively searches through the atom's loc, looking for a type path, aborting if it hits a turf
/proc/recursive_loc_path_search(atom/haystack, pathtype, max_depth = 5)
if(!haystack)
return // There is no haystack, or needle for that matter
if(max_depth <= 0)
return // we've gone too deep
if(istype(haystack, pathtype))
return haystack
if(isturf(haystack))
return
if(haystack.loc)
if(haystack && haystack.loc)
return recursive_loc_path_search(haystack.loc, pathtype, max_depth - 1)

/// Recursively searches through everything in a turf for atoms. Will recursively search through all those atoms for atoms, and so on.
Expand Down
4 changes: 2 additions & 2 deletions code/controllers/subsystem/second_wind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ SUBSYSTEM_DEF(secondwind)
"Percentage" = 100,
"TargTime" = SSsecondwind.life_cooldown,
)
if(third_winded || HAS_TRAIT(master, TRAIT_NO_SECOND_WIND))
if(third_winded || (master && HAS_TRAIT(master, TRAIT_NO_SECOND_WIND)))
.["PBarColors"] = "bad"
.["TimeText"] = "Never!"
.["Percentage"] = 0
Expand Down Expand Up @@ -474,7 +474,7 @@ SUBSYSTEM_DEF(secondwind)
"DedPercentage" = 100,
"DedTargTime" = SSsecondwind.death_delay,
)
if(third_winded || HAS_TRAIT(master, TRAIT_NO_SECOND_WIND))
if(third_winded || (master && HAS_TRAIT(master, TRAIT_NO_SECOND_WIND)))
.["DedPBarColors"] = "bad"
.["DedTimeText"] = "Never!"
.["DedPercentage"] = 0
Expand Down
2 changes: 2 additions & 0 deletions code/datums/components/plumbing/_plumbing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
/datum/component/plumbing/proc/transfer_to(datum/component/plumbing/target, amount, reagent, datum/ductnet/net)
if(!reagents || !target || !target.reagents)
return FALSE
if(amount < 0) // You cannot transfer a negative amount. Increased lag has a bad habit of calling this with negative volumes
return FALSE
if(reagent)
reagents.trans_id_to(target.parent, reagent, amount)
else
Expand Down
2 changes: 2 additions & 0 deletions code/datums/components/storage/ui.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@
var/list/atom/contents = accessible_items()
// our volume
var/our_volume = get_max_volume()
if (our_volume == 0)
our_volume = 0.01 // We cannot have a zero volume, or else bad things happen
/// Number of pixels in one line
var/horizontal_pixels = FLOOR((maxcolumns * world.icon_size) - (VOLUMETRIC_STORAGE_EDGE_PADDING * 2), our_volume)
/// the actual number of pixels in one line, not rounded to the nearest volume bit
Expand Down
4 changes: 3 additions & 1 deletion code/datums/components/swarming.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
other_swarm.swarm_members |= src

/datum/component/swarming/proc/leave_swarm(datum/source, atom/movable/AM)
var/datum/component/swarming/other_swarm = AM.GetComponent(/datum/component/swarming)
var/datum/component/swarming/other_swarm
if (AM)
other_swarm = AM.GetComponent(/datum/component/swarming)
if(!other_swarm || !(other_swarm in swarm_members))
return
swarm_members -= other_swarm
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/tackle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
return

user.tackling = TRUE
RegisterSignal(user, COMSIG_MOVABLE_MOVED, .proc/checkObstacle)
RegisterSignal(user, COMSIG_MOVABLE_MOVED, .proc/checkObstacle, TRUE)
playsound(user, 'sound/weapons/thudswoosh.ogg', 40, TRUE, -1)

var/leap_word = iscatperson(user) ? "pounce" : "leap" ///If cat, "pounce" instead of "leap".
Expand Down
2 changes: 1 addition & 1 deletion code/datums/emotes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
continue
if(!(ghost.client.prefs.chat_toggles & CHAT_GHOSTSIGHT))
continue
if(client.ckey in ghost.client.prefs.aghost_squelches)
if(client && client.ckey && (client.ckey in ghost.client.prefs.aghost_squelches)) // We cannot assume they have a client.
continue
if(admin_only && !check_rights_for(ghost.client, R_ADMIN))
continue
Expand Down
2 changes: 1 addition & 1 deletion code/datums/mood_events/generic_positive_events.dm
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@

/datum/mood_event/hugbox
description = span_nicegreen("I hugged a box of hugs recently...")
mood_change = list(-2, -1, 0, 1, 2)
mood_change = 1
timeout = 5 MINUTES

/datum/mood_event/plushpet
Expand Down
5 changes: 5 additions & 0 deletions code/game/atoms_movement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,11 @@
Move(target_turf, get_dir(src, target_turf), glide_size_override)
moving_from_pull = null

//Called after a successful Move(). For Cameras.
/atom/movable/proc/CamMoved(atom/old_loc, movement_dir, forced = FALSE, list/old_locs)
move_stacks++
Moved(old_loc, movement_dir, forced, old_locs)

//Called after a successful Move(). By this point, we've already moved
/atom/movable/proc/Moved(atom/old_loc, movement_dir, forced = FALSE, list/old_locs)
SHOULD_CALL_PARENT(TRUE)
Expand Down
8 changes: 4 additions & 4 deletions code/game/objects/hand_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@
. = ..()
if(!istype(M))
return
M.apply_damage(30, STAMINA, "chest", M.run_armor_check("chest", "brute"))
M.apply_damage(30, STAMINA, "chest", M.run_armor_check("chest", "melee"))


/obj/item/hand_item/clawer
Expand Down Expand Up @@ -390,7 +390,7 @@
. = ..()
if(!istype(M))
return
M.apply_damage(30, STAMINA, "chest", M.run_armor_check("chest", "brute"))
M.apply_damage(30, STAMINA, "chest", M.run_armor_check("chest", "melee"))

/obj/item/hand_item/arm_blade/mutation
name = "arm blade"
Expand Down Expand Up @@ -481,7 +481,7 @@
. = ..()
if(!istype(M))
return
M.apply_damage(30, STAMINA, "chest", M.run_armor_check("chest", "brute"))
M.apply_damage(30, STAMINA, "chest", M.run_armor_check("chest", "melee"))

/obj/item/hand_item/tail/thago
name = "dangerous tail"
Expand Down Expand Up @@ -510,7 +510,7 @@
. = ..()
if(!istype(M))
return
M.apply_damage(1, STAMINA, "chest", M.run_armor_check("chest", "brute"))
M.apply_damage(1, STAMINA, "chest", M.run_armor_check("chest", "melee"))

// /obj/item/hand_item/healable/licker/proc/bandage_wound(mob/living/licked, mob/living/carbon/user)
// if(!iscarbon(licked))
Expand Down
19 changes: 15 additions & 4 deletions code/modules/client/preferences_savefile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
return -1

/datum/preferences/proc/update_save(savefile/S)
current_version = safe_json_decode(S["current_version"])
if(S["current_version"])
current_version = safe_json_decode(S["current_version"])
var/list/needs_updating = list()
needs_updating ^= PREFERENCES_MASTER_CHANGELOG
if(LAZYLEN(needs_updating))
Expand Down Expand Up @@ -720,7 +721,10 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["feature_mcolor2"] >> features["mcolor2"]
S["feature_mcolor3"] >> features["mcolor3"]
// note safe json decode will runtime the first time it migrates but this is fine and it solves itself don't worry about it if you see it error
features["mam_body_markings"] = safe_json_decode(S["feature_mam_body_markings"])
if (S["feature_mam_body_markings"])
features["mam_body_markings"] = safe_json_decode(S["feature_mam_body_markings"])
else
features["mam_body_markings"] = list()
S["feature_mam_tail"] >> features["mam_tail"]
S["feature_mam_ears"] >> features["mam_ears"]
S["feature_mam_tail_animated"] >> features["mam_tail_animated"]
Expand Down Expand Up @@ -853,8 +857,15 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["allow_being_prey"] >> allow_being_prey
S["allow_seeing_belly_descriptions"] >> allow_seeing_belly_descriptions
S["allow_being_sniffed"] >> allow_being_sniffed
belly_prefs = safe_json_decode(S["belly_prefs"])
current_version = safe_json_decode(S["current_version"])
if (S["belly_prefs"])
belly_prefs = safe_json_decode(S["belly_prefs"])
else
belly_prefs = list()

if (S["current_version"])
current_version = safe_json_decode(S["current_version"])
else
belly_prefs = list()

//try to fix any outdated data if necessary
//preference updating will handle saving the updated data for us.
Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/suits/arfsuits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2351,7 +2351,7 @@
pocket_storage_component_path = /datum/component/storage/concrete/pockets/duster
slowdown = ARMOR_SLOWDOWN_MEDIUM * ARMOR_SLOWDOWN_LESS_T1 * ARMOR_SLOWDOWN_GLOBAL_MULT
armor = ARMOR_VALUE_MEDIUM
armor_tier_desc = list(ARMOR_MODIFIER_DOWN_MELEE_T1 , ARMOR_MODIFIER_DOWN_ENERGY_T1 , ARMOR_MODIFIER_UP_BULLET_T2 , ARMOR_MODIFIER_UP_DT_T1)
armor_tokens = list(ARMOR_MODIFIER_DOWN_MELEE_T1 , ARMOR_MODIFIER_DOWN_ENERGY_T1 , ARMOR_MODIFIER_UP_BULLET_T2 , ARMOR_MODIFIER_UP_DT_T1)


/obj/item/clothing/suit/armor/medium/ballisticvest/rusvest1
Expand Down
2 changes: 2 additions & 0 deletions code/modules/food_and_drinks/food/snacks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ All foods are distributed among various categories. Use common sense.
/obj/item/reagent_containers/food/snacks/proc/On_Consume(mob/living/eater)
if(!eater)
return
if(!loc)
return
if(!reagents.total_volume)
var/mob/living/location = loc
var/obj/item/trash_item = generate_trash(location)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/camera/camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/mob/camera/forceMove(atom/destination)
var/oldloc = loc
loc = destination
Moved(oldloc, NONE, TRUE)
CamMoved(oldloc, NONE, TRUE)

/mob/camera/canUseStorage()
return FALSE
Expand Down
4 changes: 4 additions & 0 deletions code/modules/mob/living/carbon/human/emote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@
if(!..())
return FALSE
var/mob/living/carbon/human/H = user
if(!istype(H))
return FALSE
return H.dna && H.dna.species && H.dna.species.can_wag_tail(user)

/datum/emote/living/carbon/human/wag/select_message_type(mob/user)
Expand Down Expand Up @@ -148,6 +150,8 @@
if(!..())
return FALSE
var/mob/living/carbon/human/H = user
if(!istype(H))
return FALSE
if(H.dna && H.dna.species && (H.dna.features["wings"] != "None"))
return TRUE

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1519,7 +1519,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
if(!damage || !affecting)//future-proofing for species that have 0 damage/weird cases where no zone is targeted
playsound(target.loc, user.dna.species.miss_sound, 25, TRUE, -1)
target.visible_message(span_danger("[user]'s [atk_verb] misses [target]!"), \
span_danger("You avoid [user]'s [atk_verb]!"), span_hear("You hear a swoosh!"), null, COMBAT_MESSAGE_RANGE, null, \
span_danger("You avoid [user]'s [atk_verb]!"), span_hear("You hear a swoosh!"), COMBAT_MESSAGE_RANGE, null, \
user, span_warning("Your [atk_verb] misses [target]!"))
log_combat(user, target, "attempted to punch")
return FALSE
Expand Down
17 changes: 10 additions & 7 deletions code/modules/mob/living/carbon/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@

//Procs called while dead
/mob/living/carbon/proc/handle_death()
for(var/datum/reagent/R in reagents.reagent_list)
if(R.chemical_flags & REAGENT_DEAD_PROCESS)
R.on_mob_dead(src)
if(reagents)
for(var/datum/reagent/R in reagents.reagent_list)
if(R.chemical_flags & REAGENT_DEAD_PROCESS)
R.on_mob_dead(src)

///////////////
// BREATHING //
Expand Down Expand Up @@ -342,8 +343,9 @@
return

// No decay if formaldehyde/preservahyde in corpse or when the corpse is charred
if(reagents.has_reagent(/datum/reagent/toxin/formaldehyde, 1) || HAS_TRAIT(src, TRAIT_HUSK) || reagents.has_reagent(/datum/reagent/preservahyde, 1))
return
if(reagents )
if(reagents.has_reagent(/datum/reagent/toxin/formaldehyde, 1) || HAS_TRAIT(src, TRAIT_HUSK) || reagents.has_reagent(/datum/reagent/preservahyde, 1))
return

// Also no decay if corpse chilled or not organic/undead
if((bodytemperature <= T0C-10) || !(mob_biotypes & (MOB_ORGANIC|MOB_UNDEAD)))
Expand Down Expand Up @@ -386,8 +388,9 @@
if(O)
O.on_life()
else
if(reagents.has_reagent(/datum/reagent/toxin/formaldehyde, 1) || reagents.has_reagent(/datum/reagent/preservahyde, 1)) // No organ decay if the body contains formaldehyde. Or preservahyde.
return
if(reagents)
if(reagents.has_reagent(/datum/reagent/toxin/formaldehyde, 1) || reagents.has_reagent(/datum/reagent/preservahyde, 1)) // No organ decay if the body contains formaldehyde. Or preservahyde.
return
for(var/V in internal_organs)
var/obj/item/organ/O = V
if(O)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/simple_animal/hostile/hostile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@
var/mob/living/L = the_target
if(SEND_SIGNAL(L, COMSIG_HOSTILE_CHECK_FACTION, src) == SIMPLEMOB_IGNORE)
return FALSE
var/faction_check = !foes[L] && faction_check_mob(L)
var/faction_check = !(L in foes) && faction_check_mob(L)
if(robust_searching)
if(faction_check && !attack_same)
return FALSE
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/simple_animal/simple_animal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ GLOBAL_LIST_EMPTY(playmob_cooldowns)
var/slow = 0
if(client && !HAS_TRAIT(src, TRAIT_IGNOREDAMAGESLOWDOWN))//Player controlled animal
var/health_percent = ((health/maxHealth)*100)//1-100 scale for health
if(health_percent <= 50)//Start slowdown at half health
if(health_percent <= 50 && health_percent > 0)//Start slowdown at half health, stop slowdown when health is at or below zero to prevent divide by zero errors
slow += ((50/health_percent)/2)//0.5 slowdown at 1/2 health, 1 slowdown at 1/4 health, etc
add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/damage_slowdown, TRUE, slow)

Expand Down Expand Up @@ -985,7 +985,7 @@ GLOBAL_LIST_EMPTY(playmob_cooldowns)
. = ..()
if(stat == DEAD)
return
if (idlesound)
if (idlesound && !(islist(idlesound) && LAZYLEN(idlesound) == 0))
if (prob(5))
var/chosen_sound = pick(idlesound)
playsound(src, chosen_sound, 60, FALSE, ignore_walls = FALSE)
Expand Down
8 changes: 4 additions & 4 deletions code/modules/mob/logout.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

..()

var/datum/atom_hud/H = GLOB.huds[GENITAL_PORNHUD]
H.remove_hud_from(src)
var/datum/atom_hud/tail_hud = GLOB.huds[TAIL_HUD_DATUM]
tail_hud.remove_hud_from(src)
// var/datum/atom_hud/H = GLOB.huds[GENITAL_PORNHUD]
// H.remove_hud_from(src)
// var/datum/atom_hud/tail_hud = GLOB.huds[TAIL_HUD_DATUM]
// tail_hud.remove_hud_from(src)

if(loc)
loc.on_log(FALSE)
Expand Down
19 changes: 10 additions & 9 deletions code/modules/reagents/chemistry/holder.dm
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,17 @@
var/part = amount / src.total_volume
var/trans_data = null
var/list/transferred = list()
for(var/reagent in cached_reagents)
var/datum/reagent/T = reagent
var/transfer_amount = T.volume * part
if(preserve_data)
trans_data = copy_data(T)
post_copy_data(T)
transferred += "[T] - [transfer_amount]"
if (part > 0 && amount > 0) //You cannot transfer a negative part or amount
for(var/reagent in cached_reagents)
var/datum/reagent/T = reagent
var/transfer_amount = T.volume * part
if(preserve_data)
trans_data = copy_data(T)
post_copy_data(T)
transferred += "[T] - [transfer_amount]"

R.add_reagent(T.type, transfer_amount * multiplier, trans_data, chem_temp, T.purity, pH, no_react = TRUE, ignore_pH = TRUE) //we only handle reaction after every reagent has been transfered.
remove_reagent(T.type, transfer_amount, ignore_pH = TRUE)
R.add_reagent(T.type, transfer_amount * multiplier, trans_data, chem_temp, T.purity, pH, no_react = TRUE, ignore_pH = TRUE) //we only handle reaction after every reagent has been transfered.
remove_reagent(T.type, transfer_amount, ignore_pH = TRUE)

if(log && amount > 0)
var/atom/us = my_atom
Expand Down
4 changes: 2 additions & 2 deletions config/maps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ Format:
endmap

map pahrump-everything
default
adminonly
endmap

map pahrump-only
adminonly
default
endmap

map pahrump-garland
Expand Down
2 changes: 2 additions & 0 deletions modular_coyote/code/modules/say/soundbubbles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ GLOBAL_LIST_INIT(typing_indicator_max_words_spoken_list, list(

if(get_typing_indicator_pref() == GLOB.play_methods[PLAY_ANIMALCROSSING_TI]) //we are checking if they actually have this preference turned on
var/TI_frequency
if (!isnum(counter)) //something went wrong with the counter and it needs to be fixed. Quick, do SOMETHING!
counter = 4
for(var/i in 1 to counter)
TI_frequency = rand(get_typing_indicator_pitch() - get_typing_indicator_variance(), get_typing_indicator_pitch() + get_typing_indicator_variance())
playsound(get_turf(src), get_typing_indicator_sound(), get_typing_indicator_volume(), FALSE, null, SOUND_FALLOFF_EXPONENT, TI_frequency)
Expand Down