From 7afb3f435dbac101ebd7540cff46b474d8d67ac5 Mon Sep 17 00:00:00 2001 From: "elly1989@rocketmail.com" Date: Thu, 12 Apr 2012 04:44:07 +0000 Subject: [PATCH] Fixing dem runtimes: Temp-fix for mob/say.dm It's being sent null from Tcomms, so I'll leave it to somebody with experience with that. Fix for items bein in your inventory and on the floor Fix to stop people pulling themselves and causing runtimes (lol) Fixes a bunch of stuff in the flash code. EMPs will now cause flashes to flash their holder. They don't runtime when flashing cadavers. They don't runtime when being EMPed. They will (hopefully) rev those select few buggy people who weren't getting reved previously. (I can't fix that totally without playing with a bunch of mind stuff) Fix for throwing nothing. :P Fix for removing tanks that don't exist from transfer valves. ummm...I think that's it git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3441 316c924e-a436-60f5-8080-3fe189b3f50e --- code/game/objects/devices/flash.dm | 100 ++++++++++++++++------------ code/game/objects/transfer_valve.dm | 36 +++++----- code/game/throwing.dm | 2 +- code/game/turf.dm | 5 ++ code/modules/mob/mob.dm | 2 +- code/modules/mob/say.dm | 4 +- 6 files changed, 86 insertions(+), 63 deletions(-) diff --git a/code/game/objects/devices/flash.dm b/code/game/objects/devices/flash.dm index 2540b93ee7f..6a6ff10dc40 100644 --- a/code/game/objects/devices/flash.dm +++ b/code/game/objects/devices/flash.dm @@ -15,14 +15,25 @@ var/last_used = 0 //last world.time it was used. /obj/item/device/flash/proc/clown_check(var/mob/user) - if((user.mutations & CLUMSY) && prob(50)) + if(user && (user.mutations & CLUMSY) && prob(50)) user << "\red The Flash slips out of your hand." user.drop_item() return 0 return 1 +/obj/item/device/flash/proc/flash_recharge() + //capacitor recharges over time + for(var/i=0, i<3, i++) + if(last_used+600 > world.time) + break + last_used += 600 + times_used -= 2 + last_used = world.time + times_used = max(0,round(times_used)) //sanity + /obj/item/device/flash/attack(mob/living/M as mob, mob/user as mob) + if(!user || !M) return //sanity M.attack_log += text("\[[time_stamp()]\] Has been flashed (attempt) with [src.name] by [user.name] ([user.ckey])") user.attack_log += text("\[[time_stamp()]\] Used the [src.name] to flash [M.name] ([M.ckey])") @@ -31,30 +42,24 @@ if(!clown_check(user)) return if(broken) - user.show_message("\red The [src.name] is broken", 2) + user.show_message("The [src.name] is broken.", 2) return - //capacitor recharges over time - for(var/i=0, i<3, i++) - if(last_used+600 > world.time) - break - last_used += 600 - times_used-- + flash_recharge() //spamming the flash before it's fully charged (60seconds) increases the chance of it breaking //It will never break on the first use. - times_used = max(0,round(times_used)) //sanity switch(times_used) if(0 to 5) last_used = world.time if(prob(times_used)) //if you use it 5 times in a minute it has a 10% chance to break! broken = 1 - user << "\red The bulb has burnt out!" + user << "The bulb has burnt out!" icon_state = "flashburnt" return times_used++ else //can only use it 5 times a minute - user.show_message("\red *click* *click*", 2) + user.show_message("*click* *click*", 2) return playsound(src.loc, 'flash.ogg', 100, 1) var/flashfail = 0 @@ -65,22 +70,25 @@ M.Weaken(10) flick("e_flash", M.flash) - if(ishuman(M) && ishuman(user)) - if(user.mind in ticker.mode.head_revolutionaries) + if(ishuman(M) && ishuman(user) && M.stat!=DEAD) + if(user.mind && user.mind in ticker.mode.head_revolutionaries) var/revsafe = 0 for(var/obj/item/weapon/implant/loyalty/L in M) if(L && L.implanted) revsafe = 1 break - if(M.mind.has_been_rev) - revsafe = 2 - if(!revsafe) - M.mind.has_been_rev = 1 - ticker.mode.add_revolutionary(M.mind) - else if(revsafe == 1) - user << "\red Something seems to be blocking the flash!" - else - user << "\red This mind seems resistant to the flash!" + M:update_mind() //give them a mind datum if they don't have one. won't work if they are logged out/ghosted or something. + if(M.mind) + if(M.mind.has_been_rev) + revsafe = 2 + if(!revsafe) + M.mind.has_been_rev = 1 + ticker.mode.add_revolutionary(M.mind) + else if(revsafe == 1) + user << "Something seems to be blocking the flash!" + else + user << "This mind seems resistant to the flash!" + user << "This mind is so vacant that it is not susceptible to influence!" else flashfail = 1 @@ -101,50 +109,42 @@ sleep(5) del(animation) - if(!flashfail) + flick("flash2", src) for(var/mob/O in viewers(user, null)) - O.show_message(text("\red [] blinds [] with the flash!", user, M)) + O.show_message("[user] blinds [M] with the flash!") else for(var/mob/O in viewers(user, null)) - O.show_message(text("\blue [] fails to blind [] with the flash!", user, M)) - + O.show_message("[user] fails to blind [M] with the flash!") return + + /obj/item/device/flash/attack_self(mob/living/carbon/user as mob, flag = 0, emp = 0) - if(!emp) - if (!clown_check(user)) return + if(!user || !clown_check(user)) return if(broken) - if(user) - user.show_message("\red The [src.name] is broken", 2) + user.show_message("The [src.name] is broken", 2) return - //capacitor recharges over time - for(var/i=0, i<3, i++) - if(last_used+600 > world.time) - break - last_used += 600 - times_used -= 2 - last_used = world.time + flash_recharge() //spamming the flash before it's fully charged (60seconds) increases the chance of it breaking //It will never break on the first use. - times_used = max(0,round(times_used)) //sanity switch(times_used) if(0 to 5) if(prob(2*times_used)) //if you use it 5 times in a minute it has a 10% chance to break! broken = 1 - user << "\red The bulb has burnt out!" + user << "The bulb has burnt out!" icon_state = "flashburnt" return times_used++ else //can only use it 5 times a minute - user.show_message("\red *click* *click*", 2) + user.show_message("*click* *click*", 2) return playsound(src.loc, 'flash.ogg', 100, 1) flick("flash2", src) - if(isrobot(user)) + if(user && isrobot(user)) spawn(0) var/atom/movable/overlay/animation = new(user.loc) animation.layer = user.layer + 1 @@ -168,5 +168,21 @@ return /obj/item/device/flash/emp_act(severity) - src.attack_self(null,1,1) + if(broken) return + flash_recharge() + switch(times_used) + if(0 to 5) + if(prob(2*times_used)) + broken = 1 + icon_state = "flashburnt" + return + times_used++ + if(istype(loc, /mob/living/carbon)) + var/mob/living/carbon/M = loc + var/safety = M.eyecheck() + if(safety <= 0) + M.Weaken(10) + flick("e_flash", M.flash) + for(var/mob/O in viewers(M, null)) + O.show_message("[M] is blinded by the flash!") ..() diff --git a/code/game/objects/transfer_valve.dm b/code/game/objects/transfer_valve.dm index 02619098249..39660bbbe6f 100644 --- a/code/game/objects/transfer_valve.dm +++ b/code/game/objects/transfer_valve.dm @@ -1,6 +1,6 @@ /obj/item/device/transfer_valve icon = 'assemblies.dmi' - name = "Tank transfer valve" // because that's what it is exadv1 and don't you dare change it + name = "tank transfer valve" icon_state = "valve_1" desc = "Regulates the transfer of air between two tanks" var/obj/item/weapon/tank/tank_one @@ -19,34 +19,34 @@ attackby(obj/item/item, mob/user) if(istype(item, /obj/item/weapon/tank)) if(tank_one && tank_two) - user << "\red There are already two tanks attached, remove one first!" + user << "There are already two tanks attached, remove one first." return if(!tank_one) tank_one = item user.drop_item() item.loc = src - user << "\blue You attach the tank to the transfer valve" + user << "You attach the tank to the transfer valve." else if(!tank_two) tank_two = item user.drop_item() item.loc = src - user << "\blue You attach the tank to the transfer valve!" + user << "You attach the tank to the transfer valve." update_icon() //TODO: Have this take an assemblyholder else if(isassembly(item)) var/obj/item/device/assembly/A = item if(A.secured) - user << "\red The device is secured!" + user << "The device is secured." return if(attached_device) - user << "\red There is already an device attached to the valve, remove it first!" + user << "There is already an device attached to the valve, remove it first." return user.remove_from_mob(item) attached_device = A A.loc = src - user << "\blue You attach the [item] to the valve controls and secure it!" + user << "You attach the [item] to the valve controls and secure it." A.holder = src A.toggle_secure() @@ -75,39 +75,39 @@ onclose(user, "trans_valve") return - + //CARN: MARKER Topic(href, href_list) ..() - if (usr.stat|| usr.restrained()) + if ( usr.stat || usr.restrained() ) return if (src.loc == usr) - if(href_list["tankone"]) + if(tank_one && href_list["tankone"]) split_gases() valve_open = 0 tank_one.loc = get_turf(src) tank_one = null update_icon() - if(href_list["tanktwo"]) + else if(tank_two && href_list["tanktwo"]) split_gases() valve_open = 0 tank_two.loc = get_turf(src) tank_two = null update_icon() - if(href_list["open"]) + else if(href_list["open"]) toggle_valve() - if(href_list["rem_device"]) - if(attached_device) + else if(attached_device) + if(href_list["rem_device"]) attached_device.loc = get_turf(src) attached_device:holder = null attached_device = null - update_icon() - if(href_list["device"]) - attached_device.attack_self(usr) + update_icon() + if(href_list["device"]) + attached_device.attack_self(usr) src.attack_self(usr) - src.add_fingerprint(usr) return + return process_activation(var/obj/item/device/D) if(toggle) diff --git a/code/game/throwing.dm b/code/game/throwing.dm index a24a2aa550a..d79e40a0aec 100644 --- a/code/game/throwing.dm +++ b/code/game/throwing.dm @@ -25,7 +25,7 @@ /mob/living/carbon/proc/throw_item(atom/target) src.throw_mode_off() - if(usr.stat) + if(usr.stat || !target) return if(target.type == /obj/screen) return diff --git a/code/game/turf.dm b/code/game/turf.dm index ed7dc95a734..c898b98a0e0 100644 --- a/code/game/turf.dm +++ b/code/game/turf.dm @@ -1087,6 +1087,11 @@ turf/simulated/floor/return_siding_icon_state() return if (ismob(user.pulling)) var/mob/M = user.pulling + +// if(M==user) //temporary hack to stop runtimes. ~Carn +// user.pulling = null //but...fixed the root of the problem +// return //shoudn't be needed now, unless somebody fucks with pulling again. + var/mob/t = M.pulling M.pulling = null step(user.pulling, get_dir(user.pulling.loc, src)) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 6798001bef6..fa8f15b2667 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -659,7 +659,7 @@ set category = "IC" set src in oview(1) - if (!( usr )) + if ( !usr || usr==src || !istype(src.loc,/turf) ) //if there's no person pulling OR the person is pulling themself OR the object being pulled is inside something: abort! return if (!( anchored )) usr.pulling = src diff --git a/code/modules/mob/say.dm b/code/modules/mob/say.dm index cc263be5161..7e0a3cf172b 100644 --- a/code/modules/mob/say.dm +++ b/code/modules/mob/say.dm @@ -52,6 +52,8 @@ return 0 /mob/proc/say_quote(var/text) + if(!text) + return "says, \"...\""; //not the best solution, but it will stop a large number of runtimes. The cause is somewhere in the Tcomms code var/ending = copytext(text, length(text)) if (src.stuttering) return "stammers, \"[text]\""; @@ -59,7 +61,7 @@ return "gibbers, \"[text]\""; if (ending == "?") return "asks, \"[text]\""; - else if (ending == "!") + if (ending == "!") return "exclaims, \"[text]\""; return "says, \"[text]\"";