From dbaba791f3c9e81db9a8ed64a25647469375668d Mon Sep 17 00:00:00 2001 From: phil235 Date: Wed, 7 Oct 2015 20:57:36 +0200 Subject: [PATCH] Fixes critical bug causing multiple hits from single projectile. Fixes some other potential issues coming from changing a few del() to qdel(). Fixes not being able to shoot mob on same tile as the shooter. Fixes being able to shoot oneself by simply clicking our mob. Fixes not being able to shoot non human mobs right next to us. --- code/controllers/subsystem/ticker.dm | 9 ++++++-- code/game/machinery/computer/security.dm | 3 +++ code/modules/flufftext/Hallucination.dm | 13 ++++++----- code/modules/projectiles/firing.dm | 12 +++++----- code/modules/projectiles/gun.dm | 25 +++++++++++---------- html/changelogs/phil235-BugFixBoogalooA.yml | 10 +++++++++ 6 files changed, 46 insertions(+), 26 deletions(-) create mode 100644 html/changelogs/phil235-BugFixBoogalooA.yml diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 818abd5098d..a4d55e4236c 100644 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -140,6 +140,7 @@ var/datum/subsystem/ticker/ticker if(!mode.can_start()) world << "Unable to start [mode.name]. Not enough players, [mode.required_players] players and [mode.required_enemies] eligible antagonists needed. Reverting to pre-game lobby." qdel(mode) + mode = null SSjob.ResetOccupations() return 0 @@ -151,6 +152,7 @@ var/datum/subsystem/ticker/ticker if(!Debug2) if(!can_continue) qdel(mode) + mode = null world << "Error setting up [master_mode]. Reverting to pre-game lobby." SSjob.ResetOccupations() return 0 @@ -291,8 +293,11 @@ var/datum/subsystem/ticker/ticker flick("station_intact",cinematic) world << sound('sound/ambience/signal.ogg') sleep(100) - if(cinematic) qdel(cinematic) - if(temp_buckle) qdel(temp_buckle) + if(cinematic) + qdel(cinematic) + cinematic = null + if(temp_buckle) + qdel(temp_buckle) return //Faster exit, since nothing happened else //Station nuked (nuke,explosion,summary) flick("intro_nuke",cinematic) diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 21b7b401754..8cc89bfb8c7 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -668,6 +668,7 @@ What a mess.*/ if(active2) data_core.security -= active2 qdel(active2) + active2 = null if("Delete Record (ALL) Execute") if(active1) @@ -679,10 +680,12 @@ What a mess.*/ break data_core.general -= active1 qdel(active1) + active1 = null if(active2) data_core.security -= active2 qdel(active2) + active2 = null else temp = "This function does not appear to be working at the moment. Our apologies." diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index 46a6f1e7429..571a2cf61a3 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -140,27 +140,28 @@ Gunshots/explosions/opening doors/less rare audio (done) radius++ if(radius > FAKE_FLOOD_MAX_RADIUS) qdel(src) + return Expand() next_expand = world.time + FAKE_FLOOD_EXPAND_TIME - return /obj/effect/hallucination/fake_flood/proc/Expand() - if(!flood_turfs) //for qdel - return for(var/turf/T in circlerangeturfs(loc,radius)) if((T in flood_turfs)|| T.blocks_air) continue flood_images += image(image_icon,T,image_state,MOB_LAYER) flood_turfs += T - if(target.client) target.client.images |= flood_images - return + if(target.client) + target.client.images |= flood_images /obj/effect/hallucination/fake_flood/Destroy() SSobj.processing.Remove(src) qdel(flood_turfs) - if(target.client) target.client.images.Remove(flood_images) + flood_turfs = list() + if(target.client) + target.client.images.Remove(flood_images) target = null qdel(flood_images) + flood_images = list() return ..() /obj/effect/hallucination/simple/xeno diff --git a/code/modules/projectiles/firing.dm b/code/modules/projectiles/firing.dm index 80afb0f065c..507a224cc35 100644 --- a/code/modules/projectiles/firing.dm +++ b/code/modules/projectiles/firing.dm @@ -6,7 +6,7 @@ ready_proj(target, user, quiet, zone_override) if(distro) targloc = spread(targloc, curloc, distro) - if(!throw_proj(targloc, user, params)) + if(!throw_proj(target, targloc, user, params)) return 0 if(i > 1) newshot() @@ -15,7 +15,7 @@ update_icon() return 1 -/obj/item/ammo_casing/proc/ready_proj(atom/target as mob|obj|turf, mob/living/user, quiet, zone_override = "") +/obj/item/ammo_casing/proc/ready_proj(atom/target, mob/living/user, quiet, zone_override = "") if (!BB) return BB.original = target @@ -30,14 +30,15 @@ reagents.trans_to(BB, reagents.total_volume) //For chemical darts/bullets qdel(reagents) -/obj/item/ammo_casing/proc/throw_proj(var/turf/targloc, mob/living/user as mob|obj, params) +/obj/item/ammo_casing/proc/throw_proj(atom/target, turf/targloc, mob/living/user, params) var/turf/curloc = user.loc if (!istype(targloc) || !istype(curloc) || !BB) return 0 if(targloc == curloc) - if(BB.original == user) //if we target ourselves we go straight to bullet_act() - user.bullet_act(BB, BB.def_zone) + if(target) //if the target is right on our location we go straight to bullet_act() + target.bullet_act(BB, BB.def_zone) qdel(BB) + BB = null return 1 BB.loc = get_turf(user) BB.starting = get_turf(user) @@ -51,7 +52,6 @@ BB.p_x = text2num(mouse_control["icon-x"]) if(mouse_control["icon-y"]) BB.p_y = text2num(mouse_control["icon-y"]) - if(BB) BB.fire() BB = null diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 02729e68ac9..e2ebfac6b69 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -122,14 +122,14 @@ /obj/item/weapon/gun/afterattack(atom/target as mob|obj|turf, mob/living/carbon/human/user as mob|obj, flag, params)//TODO: go over this if(flag) //It's adjacent, is the user, or is on the user's person - if(istype(target, /mob/) && !(target in user.contents) && target != user && user.a_intent == "harm") - //We make sure that it is a mob, it's not us or part of us. - return //Flogging action - else if(ishuman(target) && ishuman(user)) - if(user.zone_sel.selecting == "mouth") - handle_suicide(user, target, params) - return - else + if(target in user.contents) //can't shoot stuff inside us. + return + if(!ismob(target) || user.a_intent == "harm") //melee attack + return + if(user.zone_sel.selecting == "mouth") + handle_suicide(user, target, params) + return + if(target == user) //so we can't shoot ourselves (unless mouth selected) return //Exclude lasertag guns from the CLUMSY check. @@ -385,10 +385,11 @@ semicd = 1 if(!do_mob(user, target, 120) || user.zone_sel.selecting != "mouth") - if(user == target && user) - user.visible_message("[user] decided life was worth living.") - else if(user && target && target.Adjacent(user)) - target.visible_message("[user] has decided to spare [target]'s life.", "[user] has decided to spare your life!") + if(user) + if(user == target) + user.visible_message("[user] decided life was worth living.") + else if(target && target.Adjacent(user)) + target.visible_message("[user] has decided to spare [target]'s life.", "[user] has decided to spare your life!") semicd = 0 return diff --git a/html/changelogs/phil235-BugFixBoogalooA.yml b/html/changelogs/phil235-BugFixBoogalooA.yml new file mode 100644 index 00000000000..494c6f7f4e8 --- /dev/null +++ b/html/changelogs/phil235-BugFixBoogalooA.yml @@ -0,0 +1,10 @@ + +author: phil235 + +delete-after: True + +changes: + - bugfix: "Fixes critical bug causing multiple hits from single projectile." + - bugfix: "Fixes not being able to shoot a mob on same tile as the shooter." + - bugfix: "Clicking your mob (without targeting your mouth) no longer causes you to shoot yourself." + - bugfix: "Fixes not being able to shoot non human mobs at point blank."