diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index 8785634bc55..e4db4989b0f 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -506,7 +506,7 @@ 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 + if(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 diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index d34d2bb0f2e..97aef5f4afb 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -1231,6 +1231,8 @@ ///////////////////////// /obj/mecha/proc/operation_allowed(mob/living/carbon/human/H) + if(!ishuman(H)) + return 0 for(var/ID in list(H.get_active_hand(), H.wear_id, H.belt)) if(src.check_access(ID,src.operation_req_access)) return 1 diff --git a/code/game/mecha/mecha_construction_paths.dm b/code/game/mecha/mecha_construction_paths.dm index 37e1c1ee13e..223f6d4aa24 100644 --- a/code/game/mecha/mecha_construction_paths.dm +++ b/code/game/mecha/mecha_construction_paths.dm @@ -91,7 +91,7 @@ const_holder.icon_state = "ripley0" const_holder.density = 1 const_holder.overlays.len = 0 - qdel(src) + del(src) return diff --git a/code/game/turfs/simulated.dm b/code/game/turfs/simulated.dm index ef7c9e94f17..a20fb422aeb 100644 --- a/code/game/turfs/simulated.dm +++ b/code/game/turfs/simulated.dm @@ -42,8 +42,8 @@ /turf/simulated/Entered(atom/A, atom/OL) - if (istype(A,/mob/living/carbon)) - var/mob/living/carbon/M = A + if (istype(A,/mob/living/carbon/human)) + var/mob/living/carbon/human/M = A if(M.lying) return if(prob(80)) dirt++ @@ -121,7 +121,7 @@ switch (src.wet) if(1) if(istype(M, /mob/living/carbon/human)) // Added check since monkeys don't have shoes - if ((M.m_intent == "run") && !(istype(M:shoes, /obj/item/clothing/shoes) && M:shoes.flags&NOSLIP)) + if ((M.m_intent == "run") && !(istype(M:shoes, /obj/item/clothing/shoes) && M.shoes.flags&NOSLIP)) M.stop_pulling() step(M, M.dir) M << "\blue You slipped on the wet floor!" @@ -131,7 +131,7 @@ else M.inertia_dir = 0 return - else if(!istype(M, (/mob/living/carbon/slime || /mob/living/carbon/human/slime)) || (M:species.bodyflags & FEET_NOSLIP)) + else if(!istype(M, (/mob/living/carbon/human/slime)) || (M.species.bodyflags & FEET_NOSLIP)) if (M.m_intent == "run") M.stop_pulling() step(M, M.dir) diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index e4fd5782590..6574a027f3e 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -387,7 +387,7 @@ BLIND // can't see anything if (!(src.loc == usr)) return - if (!( usr.restrained() ) && !( usr.stat )) + if (!( usr.restrained() ) && !( usr.stat ) && ( over_object )) switch(over_object.name) if("r_hand") usr.u_equip(src) diff --git a/code/modules/events/wallrot.dm b/code/modules/events/wallrot.dm index dfaedf451ec..739ca92411b 100644 --- a/code/modules/events/wallrot.dm +++ b/code/modules/events/wallrot.dm @@ -1,20 +1,13 @@ -/turf/simulated/wall - - -datum/event/wallrot - severity = 1 - datum/event/wallrot/setup() announceWhen = rand(0, 300) endWhen = announceWhen + 1 - severity = rand(5, 10) datum/event/wallrot/announce() command_alert("Harmful fungi detected on station. Station structures may be contaminated.", "Biohazard Alert") datum/event/wallrot/start() spawn() - var/turf/center = null + var/turf/simulated/wall/center = null // 100 attempts for(var/i=0, i<100, i++) @@ -24,14 +17,15 @@ datum/event/wallrot/start() if(center) // Make sure at least one piece of wall rots! - center:rot() + center.rot() // Have a chance to rot lots of other walls. var/rotcount = 0 + var/actual_severity = severity * rand(5, 10) for(var/turf/simulated/wall/W in range(5, center)) if(prob(50)) - W:rot() + W.rot() rotcount++ // Only rot up to severity walls - if(rotcount >= severity) + if(rotcount >= actual_severity) break \ No newline at end of file diff --git a/code/modules/mob/living/carbon/alien/special/facehugger.dm b/code/modules/mob/living/carbon/alien/special/facehugger.dm index 04295be82da..3f912cb3ce2 100644 --- a/code/modules/mob/living/carbon/alien/special/facehugger.dm +++ b/code/modules/mob/living/carbon/alien/special/facehugger.dm @@ -231,6 +231,9 @@ var/const/MAX_ACTIVE_TIME = 400 return /proc/CanHug(var/mob/M) + if(!M || !ismob(M)) + return 0 + if(M.stat == DEAD) return 0 diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index ab92ae5d573..ded2a3c949e 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1159,11 +1159,16 @@ /mob/living/carbon/human/proc/is_lung_ruptured() var/datum/organ/internal/lungs/L = internal_organs_by_name["lungs"] + if(!L) + return 0 + return L.is_bruised() /mob/living/carbon/human/proc/rupture_lung() var/datum/organ/internal/lungs/L = internal_organs_by_name["lungs"] - + if(!L) + return 0 + if(!L.is_bruised()) src.custom_pain("You feel a stabbing pain in your chest!", 1) L.damage = L.min_bruised_damage diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index c32f3973882..bd823f3c4ee 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -292,6 +292,7 @@ A.loc = src update_icon() update_gunlight(user) + verbs += /obj/item/weapon/gun/proc/toggle_gunlight if(istype(A, /obj/item/weapon/screwdriver)) if(F) if(user.l_hand != src && user.r_hand != src) @@ -304,13 +305,18 @@ update_gunlight(user) S.update_brightness(user) update_icon() + verbs -= /obj/item/weapon/gun/proc/toggle_gunlight ..() return -/obj/item/weapon/gun/verb/toggle_gunlight() +/obj/item/weapon/gun/proc/toggle_gunlight() set name = "Toggle Gunlight" set category = "Object" set desc = "Click to toggle your weapon's attached flashlight." + + if(!F) + return + var/mob/living/carbon/human/user = usr if(!isturf(user.loc)) user << "You cannot turn the light on while in this [user.loc]." diff --git a/code/modules/reagents/Chemistry-Holder.dm b/code/modules/reagents/Chemistry-Holder.dm index e8e27bba046..436dc211d61 100644 --- a/code/modules/reagents/Chemistry-Holder.dm +++ b/code/modules/reagents/Chemistry-Holder.dm @@ -398,7 +398,7 @@ datum return 1 check_gofast(var/mob/M) - if(istype(M, /mob)) + if(M && istype(M, /mob)) if(M.reagents.has_reagent("hyperzine")||M.reagents.has_reagent("nuka_cola")) return 1 else diff --git a/code/modules/reagents/Chemistry-Reagents.dm b/code/modules/reagents/Chemistry-Reagents.dm index e1ed81089cf..81b19610875 100644 --- a/code/modules/reagents/Chemistry-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents.dm @@ -2581,15 +2581,16 @@ datum return Del() - if (istype(holder.my_atom,/mob/living)) - var/mob/living/M as mob - var/to_remove = 0 - if (holder.has_reagent("anti_toxin")) - to_remove = min(holder.get_reagent_amount("anti_toxin"),data) - holder.remove_reagent("anti_toxin", to_remove, 0) - data -= to_remove - if(M) - M.adjustToxLoss((data-1)*rand(2,4)) + if(holder) + if (istype(holder.my_atom,/mob/living)) + var/mob/living/M as mob + var/to_remove = 0 + if (holder.has_reagent("anti_toxin")) + to_remove = min(holder.get_reagent_amount("anti_toxin"),data) + holder.remove_reagent("anti_toxin", to_remove, 0) + data -= to_remove + if(M) + M.adjustToxLoss((data-1)*rand(2,4)) ..() psilocybin diff --git a/code/modules/research/protolathe.dm b/code/modules/research/protolathe.dm index b1ddc3eb62a..2554415323f 100644 --- a/code/modules/research/protolathe.dm +++ b/code/modules/research/protolathe.dm @@ -199,8 +199,9 @@ Note: Must be placed west/left of and R&D console to function. busy = 0 src.updateUsrDialog() - src.overlays += "protolathe_[stack.name]" - sleep(10) - src.overlays -= "protolathe_[stack.name]" + if(stack) + src.overlays += "protolathe_[stack.name]" + sleep(10) + src.overlays -= "protolathe_[stack.name]" return diff --git a/code/modules/research/xenoarchaeology/artifact/artifact.dm b/code/modules/research/xenoarchaeology/artifact/artifact.dm index 1ba21f79667..83e5fea7781 100644 --- a/code/modules/research/xenoarchaeology/artifact/artifact.dm +++ b/code/modules/research/xenoarchaeology/artifact/artifact.dm @@ -66,8 +66,9 @@ /obj/structure/boulder/attackby(obj/item/weapon/W as obj, mob/user as mob) if (istype(W, /obj/item/device/core_sampler)) - src.geological_data.artifact_distance = rand(-100,100) / 100 - src.geological_data.artifact_id = artifact_find.artifact_id + if(geological_data) + src.geological_data.artifact_distance = rand(-100,100) / 100 + src.geological_data.artifact_id = artifact_find.artifact_id var/obj/item/device/core_sampler/C = W C.sample_item(src, user) diff --git a/code/modules/research/xenoarchaeology/finds/finds.dm b/code/modules/research/xenoarchaeology/finds/finds.dm index a8f5a8f6cb1..e2b4215128b 100644 --- a/code/modules/research/xenoarchaeology/finds/finds.dm +++ b/code/modules/research/xenoarchaeology/finds/finds.dm @@ -544,12 +544,14 @@ if(talkative) new_item.talking_atom = new() - talking_atom.holder_atom = new_item - talking_atom.init() + if(talking_atom) + talking_atom.holder_atom = new_item + talking_atom.init() del(src) else if(talkative) src.talking_atom = new() - talking_atom.holder_atom = src - talking_atom.init() + if(talking_atom) + talking_atom.holder_atom = src + talking_atom.init()