From b69d77e021d4c1521fce341a4e91e5f45c8f3e30 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 8 Jan 2015 12:44:15 -0600 Subject: [PATCH] Runtime sanity --- code/ATMOSPHERICS/he_pipes.dm | 4 +++- code/game/dna/dna2.dm | 4 +++- code/game/machinery/computer/station_alert.dm | 3 ++- code/game/machinery/cryo.dm | 4 ++-- code/game/machinery/metaldetector.dm | 20 +++++-------------- code/game/machinery/requests_console.dm | 2 +- code/modules/client/preferences.dm | 19 ++++++++++++++++++ code/modules/food/cooking_machines.dm | 2 +- code/modules/mob/living/living.dm | 5 ++++- code/modules/nano/JSON Reader.dm | 3 +++ code/modules/reagents/Chemistry-Holder.dm | 2 +- .../research/mechanic/reverse_engine.dm | 6 ++++-- .../scripting/Implementations/_Logic.dm | 2 +- 13 files changed, 49 insertions(+), 27 deletions(-) diff --git a/code/ATMOSPHERICS/he_pipes.dm b/code/ATMOSPHERICS/he_pipes.dm index 74f8ffad833..5aeb7c97f66 100644 --- a/code/ATMOSPHERICS/he_pipes.dm +++ b/code/ATMOSPHERICS/he_pipes.dm @@ -96,7 +96,9 @@ internal_removed.temperature = final_temperature internal.merge(internal_removed) - parent.network.update = 1 + + if(parent && parent.network) + parent.network.update = 1 /obj/machinery/atmospherics/pipe/simple/heat_exchanging/proc/radiate() var/datum/gas_mixture/internal = return_air() diff --git a/code/game/dna/dna2.dm b/code/game/dna/dna2.dm index 853dc24d547..1135932202d 100644 --- a/code/game/dna/dna2.dm +++ b/code/game/dna/dna2.dm @@ -84,7 +84,7 @@ var/global/list/facial_hair_styles_female_list = list() facial_hair_styles_male_list += H.name facial_hair_styles_female_list += H.name return - + ///////////////// // GENE DEFINES ///////////////// @@ -362,6 +362,8 @@ var/global/list/facial_hair_styles_female_list = list() /proc/EncodeDNABlock(var/value) + if(!isnum(value)) + WARNING("Expected a number, got [value]") return add_zero2(num2hex(value,1), 3) /datum/dna/proc/UpdateUI() diff --git a/code/game/machinery/computer/station_alert.dm b/code/game/machinery/computer/station_alert.dm index 7ee4e0ef2db..d1e26832047 100644 --- a/code/game/machinery/computer/station_alert.dm +++ b/code/game/machinery/computer/station_alert.dm @@ -16,7 +16,8 @@ ..() if(src.z != map.zMainStation) var/area/A = src.areaMaster - + if(!A) + A = get_area(src) name = "[A.general_area_name] Alert Computer" general_area_name = A.general_area_name diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index 4cb4223b0f4..45bf606d15d 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -48,14 +48,14 @@ ..() /obj/machinery/atmospherics/unary/cryo_cell/MouseDrop_T(atom/movable/O as mob|obj, mob/user as mob) + if(!ismob(O)) //humans only + return if(O.loc == user) //no you can't pull things out of your ass return if(user.restrained() || user.stat || user.weakened || user.stunned || user.paralysis || user.resting) //are you cuffed, dying, lying, stunned or other return if(O.anchored || get_dist(user, src) > 1 || get_dist(user, O) > 1 || user.contents.Find(src)) // is the mob anchored, too far away from you, or are you too far away from the source return - if(!ismob(O)) //humans only - return if(istype(O, /mob/living/simple_animal) || istype(O, /mob/living/silicon)) //animals and robutts dont fit return if(!ishuman(user) && !isrobot(user)) //No ghosts or mice putting people into the sleeper diff --git a/code/game/machinery/metaldetector.dm b/code/game/machinery/metaldetector.dm index f9b0ba71278..f49b623c524 100644 --- a/code/game/machinery/metaldetector.dm +++ b/code/game/machinery/metaldetector.dm @@ -28,8 +28,7 @@ /obj/machinery/detector/proc/assess_perp(mob/living/carbon/human/perp as mob) var/threatcount = 0 if(!(istype(perp, /mob/living/carbon))) - return - if(src.emagged == 2) return 10 + return -1 if(!src.allowed(perp)) @@ -95,10 +94,6 @@ && !istype(things, /obj/item/weapon/gun/energy/laser/practice)) threatcount += 2 - - - - if(idmode) // if(!perp.wear_id) @@ -109,24 +104,16 @@ if(!perp.wear_id) threatcount += 2 - if(istype(perp.wear_suit, /obj/item/clothing/suit/wizrobe)) threatcount += 2 if(perp.dna && perp.dna.mutantrace && perp.dna.mutantrace != "none") threatcount += 2 - - - - //Agent cards lower threatlevel. //if(perp.wear_id && istype(perp:wear_id.GetID(), /obj/item/weapon/card/id/syndicate)) ///////////////nah, i dont think so // threatcount -= 2 - - - var/passperpname = "" for (var/datum/data/record/E in data_core.general) var/perpname = perp.name @@ -146,7 +133,8 @@ break var/list/retlist = list(threatcount, passperpname) - + if(emagged) + retlist[1] = 10 return retlist @@ -273,6 +261,8 @@ if (get_dist(src, O) > src.range) continue var/list/ourretlist = src.assess_perp(O) + if(!istype(ourretlist) || !ourretlist.len) + return var/dudesthreat = ourretlist[1] var/dudesname = ourretlist[2] diff --git a/code/game/machinery/requests_console.dm b/code/game/machinery/requests_console.dm index 8bb94456dc6..728e75c2726 100644 --- a/code/game/machinery/requests_console.dm +++ b/code/game/machinery/requests_console.dm @@ -386,7 +386,7 @@ var/list/obj/machinery/requests_console/allConsoles = list() msgVerified = "Verified by [ID.registered_name] ([ID.assignment])" updateUsrDialog() if(screen == 10) - var/obj/item/weapon/card/id/ID = O + var/obj/item/weapon/card/id/ID = O.GetID() if (access_RC_announce in ID.access) announceAuth = 1 else diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index e0e0fe10328..a058e5353f0 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -330,6 +330,25 @@ var/const/MAX_SAVE_SLOTS = 8 else dat += "[copytext(flavor_text, 1, 37)]...
" + + if(!isnum(r_hair)) + WARNING("R_HAIR Expected a number") + if(!isnum(g_hair)) + WARNING("G_HAIR Expected a number") + if(!isnum(b_hair)) + WARNING("B_HAIR Expected a number") + if(!isnum(r_facial)) + WARNING("R_FACIAL Expected a number") + if(!isnum(g_facial)) + WARNING("G_FACIAL Expected a number") + if(!isnum(b_facial)) + WARNING("B_FACIAL Expected a number") + if(!isnum(r_eyes)) + WARNING("R_EYES Expected a number") + if(!isnum(g_eyes)) + WARNING("G_EYES Expected a number") + if(!isnum(b_eyes)) + WARNING("B_EYES Expected a number") // AUTOFIXED BY fix_string_idiocy.py // C:\Users\Rob\Documents\Projects\vgstation13\code\modules\client\preferences.dm:335: dat += "
" dat += {"
diff --git a/code/modules/food/cooking_machines.dm b/code/modules/food/cooking_machines.dm index 358dcdc9ec4..2cd9f8ad210 100644 --- a/code/modules/food/cooking_machines.dm +++ b/code/modules/food/cooking_machines.dm @@ -376,7 +376,7 @@ var/global/ingredientLimit = 10 sleep(src.cookTime/3) if(src.ingredient) src.ingredient.color = "#C28566" sleep(src.cookTime/3) - src.ingredient.color = "#A34719" + if(src.ingredient) src.ingredient.color = "#A34719" sleep(src.cookTime/3) src.icon_state = initial(src.icon_state) src.active = 0 diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 4fcc120d77b..22f7199abf1 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -401,7 +401,10 @@ eye_blurry = 0 ear_deaf = 0 ear_damage = 0 - reagents.clear_reagents() + if(!reagents) + create_reagents(1000) + else + reagents.clear_reagents() heal_overall_damage(1000, 1000) ExtinguishMob() fire_stacks = 0 diff --git a/code/modules/nano/JSON Reader.dm b/code/modules/nano/JSON Reader.dm index 41d218cb43d..bc3c0e62dd4 100644 --- a/code/modules/nano/JSON Reader.dm +++ b/code/modules/nano/JSON Reader.dm @@ -124,6 +124,9 @@ json_reader var/json_token/S = get_token() check_type(/json_token/symbol) + if(!S) + die() + return switch(S.value) if(",") next_token() diff --git a/code/modules/reagents/Chemistry-Holder.dm b/code/modules/reagents/Chemistry-Holder.dm index 5cdf3191ade..0eb7abadcbf 100644 --- a/code/modules/reagents/Chemistry-Holder.dm +++ b/code/modules/reagents/Chemistry-Holder.dm @@ -95,7 +95,7 @@ datum return the_id trans_to(var/obj/target, var/amount=1, var/multiplier=1, var/preserve_data=1)//if preserve_data=0, the reagents data will be lost. Usefull if you use data for some strange stuff and don't want it to be transferred. - if (!target ) + if (!target) return if (!target.reagents || src.total_volume<=0) return diff --git a/code/modules/research/mechanic/reverse_engine.dm b/code/modules/research/mechanic/reverse_engine.dm index 19d066d0ab2..b081382e63c 100644 --- a/code/modules/research/mechanic/reverse_engine.dm +++ b/code/modules/research/mechanic/reverse_engine.dm @@ -199,11 +199,13 @@ for(var/i=1;i<=research_queue.len;i++) var/datum/design/mechanic_design/research_item = research_queue[i] - todo_queue.Add(list(list("name" = research_item.name, "command1" = list("research" = i), "command2" = list("remove_tosearch" = i)))) + if(istype(research_item, /datum/design/mechanic_design)) + todo_queue.Add(list(list("name" = research_item.name, "command1" = list("research" = i), "command2" = list("remove_tosearch" = i)))) for(var/i=1;i<=ready_queue.len;i++) var/datum/design/mechanic_design/ready_item = ready_queue[i] - done_queue.Add(list(list("name" = ready_item.name, "command1" = list("print_design" = i), "command2" = list("nanoprint_design" = i), "command3" = list("remove_researched" = i)))) + if(istype(ready_item,/datum/design/mechanic_design)) + done_queue.Add(list(list("name" = ready_item.name, "command1" = list("print_design" = i), "command2" = list("nanoprint_design" = i), "command3" = list("remove_researched" = i)))) data["research_queue"] = todo_queue data["ready_queue"] = done_queue diff --git a/code/modules/scripting/Implementations/_Logic.dm b/code/modules/scripting/Implementations/_Logic.dm index 6be2f0590d1..586837884b2 100644 --- a/code/modules/scripting/Implementations/_Logic.dm +++ b/code/modules/scripting/Implementations/_Logic.dm @@ -31,7 +31,7 @@ if(L.len >= pos && !(pos > L.len)) return L[pos] else - if(L.len >= pos) + if(L.len >= pos && !(pos > L.len)) L[pos] = value else if(istext(pos)) if(!value)