From d545eb7f9fbac09d198af313c41c6a092fae5107 Mon Sep 17 00:00:00 2001 From: phil235 Date: Thu, 4 Dec 2014 01:08:04 +0100 Subject: [PATCH 1/4] Visible_message() now uses recursive_hear_check so mob inside something can see those messages. Fixes being able to see visible_message w/o seeing the src of it (happened when the src could see us but not the other way around), you no longer see visible_message from mobs inside closets for example. Fixes pAI being deaf. Removing some no longer needed occupant_message() in mecha code. Fixed some typos and span class here and there. --- code/ATMOSPHERICS/pipes/simple.dm | 2 +- code/game/machinery/doors/windowdoor.dm | 1 - code/game/mecha/mecha.dm | 18 +----------------- code/game/objects/items/toys.dm | 4 ++-- code/game/objects/structures.dm | 1 - code/game/turfs/simulated/walls.dm | 2 -- .../mob/living/carbon/human/human_defense.dm | 1 - code/modules/mob/living/living_defense.dm | 2 -- code/modules/mob/living/silicon/pai/life.dm | 6 ------ code/modules/mob/living/silicon/pai/pai.dm | 4 +--- code/modules/mob/mob.dm | 18 +++++++++++++----- code/modules/reagents/Chemistry-Holder.dm | 2 +- 12 files changed, 19 insertions(+), 42 deletions(-) diff --git a/code/ATMOSPHERICS/pipes/simple.dm b/code/ATMOSPHERICS/pipes/simple.dm index da6fce0c263..eabf5a2badb 100644 --- a/code/ATMOSPHERICS/pipes/simple.dm +++ b/code/ATMOSPHERICS/pipes/simple.dm @@ -102,7 +102,7 @@ The regular pipe you see everywhere, including bent ones. else return 1 /obj/machinery/atmospherics/pipe/simple/proc/burst() - src.visible_message("[src] bursts!"); + visible_message("[src] bursts!"); playsound(src.loc, 'sound/effects/bang.ogg', 25, 1) var/datum/effect/effect/system/harmless_smoke_spread/smoke = new smoke.set_up(1,0, src.loc, 0) diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 05caa8ff585..5a7558b60d9 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -200,7 +200,6 @@ /obj/machinery/door/window/mech_melee_attack(obj/mecha/M) if(M.damtype == "brute") playsound(src.loc, 'sound/effects/Glasshit.ogg', 75, 1) - M.occupant_message("You hit [src].") visible_message("[src] has been hit by [M.name].") take_damage(M.force) return diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 02fe27be028..225bf65a69b 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -320,7 +320,6 @@ obj/mecha/proc/can_use(mob/user) playsound(src, 'sound/items/Welder.ogg', 50, 1) else return - M.occupant_message("You hit [src].") visible_message("[src] has been hit by [M.name].") take_damage(M.force, damtype) add_logs(M.occupant, src, "attacked", object=M, addition="(INTENT: [uppertext(M.occupant.a_intent)]) (DAMTYPE: [uppertext(M.damtype)])") @@ -475,6 +474,7 @@ obj/mecha/proc/can_use(mob/user) var/damage = absorbDamage(amount,type) health -= damage update_health() + occupant_message("Taking damage!") log_append_to_last("Took [damage] points of damage. Damage type: \"[type]\".",1) /obj/mecha/proc/absorbDamage(damage,damage_type) @@ -499,7 +499,6 @@ obj/mecha/proc/can_use(mob/user) src.take_damage(15) src.check_for_internal_damage(list(MECHA_INT_TEMP_CONTROL,MECHA_INT_TANK_BREACH,MECHA_INT_CONTROL_LOST)) user.visible_message("[user] hits [src.name], doing some damage.", "You hit [src.name] with all your might. The metal creaks and bends.") - src.occupant_message("[user] hits [src.name], doing some damage.") else user.visible_message("[user] hits [src.name]. Nothing happens","You hit [src.name] with no visible effect.") src.log_append_to_last("Armor saved.") @@ -517,14 +516,11 @@ obj/mecha/proc/can_use(mob/user) src.take_damage(15) src.check_for_internal_damage(list(MECHA_INT_TEMP_CONTROL,MECHA_INT_TANK_BREACH,MECHA_INT_CONTROL_LOST)) playsound(src.loc, 'sound/weapons/slash.ogg', 50, 1, -1) - user << "You slash at the armored suit!" visible_message("The [user] slashes at [src.name]'s armor!") - src.occupant_message("The [user] slashes at [src.name]'s armor!") else src.log_append_to_last("Armor saved.") playsound(src.loc, 'sound/weapons/slash.ogg', 50, 1, -1) user << "\green Your claws had no effect!" - src.occupant_message("The [user]'s claws are stopped by the armor.") visible_message("The [user] rebounds off [src.name]'s armor!") return @@ -541,12 +537,10 @@ obj/mecha/proc/can_use(mob/user) src.take_damage(damage) src.check_for_internal_damage(list(MECHA_INT_TEMP_CONTROL,MECHA_INT_TANK_BREACH,MECHA_INT_CONTROL_LOST)) visible_message("[user] [user.attacktext] [src]!") - src.occupant_message("[user] [user.attacktext] [src]!") add_logs(user, src, "attacked", admin=0) else src.log_append_to_last("Armor saved.") playsound(src.loc, 'sound/weapons/slash.ogg', 50, 1, -1) - src.occupant_message("[user]'s attack is stopped by the armor.") visible_message("The [user] rebounds off [src.name]'s armor!") add_logs(user, src, "attacked", admin=0) return @@ -565,7 +559,6 @@ obj/mecha/proc/can_use(mob/user) src.visible_message("The [A] fastens firmly to [src].") return if(prob(src.deflect_chance) || istype(A, /mob)) - src.occupant_message("[A] bounces off the armor.") src.visible_message("[A] bounces off the [src.name] armor") src.log_append_to_last("Armor saved.") if(istype(A, /mob/living)) @@ -574,7 +567,6 @@ obj/mecha/proc/can_use(mob/user) else if(istype(A, /obj)) var/obj/O = A if(O.throwforce) - src.occupant_message("[src.name] is hit by [A].") src.visible_message("[src.name] is hit by [A].") src.take_damage(O.throwforce) src.check_for_internal_damage(list(MECHA_INT_TEMP_CONTROL,MECHA_INT_TANK_BREACH,MECHA_INT_CONTROL_LOST)) @@ -589,7 +581,6 @@ obj/mecha/proc/can_use(mob/user) /obj/mecha/proc/dynbulletdamage(var/obj/item/projectile/Proj) if(prob(src.deflect_chance)) - src.occupant_message("The armor deflects incoming projectile.") src.visible_message("The [src.name] armor deflects the projectile") src.log_append_to_last("Armor saved.") return @@ -601,7 +592,6 @@ obj/mecha/proc/can_use(mob/user) ignore_threshold = 1 if((Proj.damage_type == BRUTE || Proj.damage_type == BURN)) src.take_damage(Proj.damage,Proj.flag) - src.occupant_message("[src.name] is hit by [Proj]!") src.visible_message("[src.name] is hit by [Proj].") src.check_for_internal_damage(list(MECHA_INT_FIRE,MECHA_INT_TEMP_CONTROL,MECHA_INT_TANK_BREACH,MECHA_INT_CONTROL_LOST,MECHA_INT_SHORT_CIRCUIT),ignore_threshold) Proj.on_hit(src) @@ -677,14 +667,8 @@ obj/mecha/proc/can_use(mob/user) if(prob(src.deflect_chance)) user << "The [W] bounces off [src.name] armor." src.log_append_to_last("Armor saved.") -/* - for (var/mob/V in viewers(src)) - if(V.client && !(V.blinded)) - V.show_message("The [W] bounces off [src.name] armor.", 1) -*/ return 0 else - src.occupant_message("[user] hits [src] with [W].") user.visible_message("[user] hits [src] with [W].", "You hit [src] with [W].") src.take_damage(W.force,W.damtype) src.check_for_internal_damage(list(MECHA_INT_TEMP_CONTROL,MECHA_INT_TANK_BREACH,MECHA_INT_CONTROL_LOST)) diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index 9b91799d00e..30f01ef2e6a 100644 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -67,7 +67,7 @@ /obj/item/toy/balloon/throw_impact(atom/hit_atom) if(src.reagents.total_volume >= 1) - src.visible_message("The [src] bursts!","You hear a pop and a splash.") + src.visible_message("\The [src] bursts!","You hear a pop and a splash.") src.reagents.reaction(get_turf(hit_atom)) for(var/atom/A in get_turf(hit_atom)) src.reagents.reaction(A) @@ -735,7 +735,7 @@ obj/item/toy/cards/deck/attack_hand(mob/user as mob) src.cards -= choice H.pickup(user) user.put_in_active_hand(H) - src.visible_message("[user] draws a card from the deck.", "You draw a card from the deck.") + user.visible_message("[user] draws a card from the deck.", "You draw a card from the deck.") if(cards.len > 26) src.icon_state = "deck_[deckstyle]_full" else if(cards.len > 10) diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm index 9d6b1269e9f..aaea66cb517 100644 --- a/code/game/objects/structures.dm +++ b/code/game/objects/structures.dm @@ -12,7 +12,6 @@ /obj/structure/mech_melee_attack(obj/mecha/M) if(M.damtype == "brute") - M.occupant_message("You hit [src].") visible_message("[src] has been hit by [M.name].") return 1 return 0 diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index 0ea09fc2316..e6ae9a49027 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -77,11 +77,9 @@ /turf/simulated/wall/mech_melee_attack(obj/mecha/M) if(M.damtype == "brute") playsound(src, 'sound/weapons/punch4.ogg', 50, 1) - M.occupant_message("You hit [src].") visible_message("[src] has been hit by [M.name].") if(prob(5) && M.force > 20) dismantle_wall(1) - M.occupant_message("You smash through the wall.") visible_message("[src.name] smashes through the wall!") playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 7b9b0749916..32035a955cc 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -398,7 +398,6 @@ emp_act update_damage_overlays(0) updatehealth() - M.occupant_message("You hit [src].") visible_message("[src] has been hit by [M.name].", \ "[src] has been hit by [M.name].") add_logs(M.occupant, src, "attacked", object=M, addition="(INTENT: [uppertext(M.occupant.a_intent)]) (DAMTYPE: [uppertext(M.damtype)])") diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 87e9a0741c4..4d7e77f370e 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -86,14 +86,12 @@ proc/vol_by_throwforce_and_or_w_class(var/obj/item/I) else return updatehealth() - M.occupant_message("You hit [src].") visible_message("[src] has been hit by [M.name].", \ "[src] has been hit by [M.name].") add_logs(M.occupant, src, "attacked", object=M, addition="(INTENT: [uppertext(M.occupant.a_intent)]) (DAMTYPE: [uppertext(M.damtype)])") else step_away(src,M) add_logs(M.occupant, src, "pushed", object=M, admin=0) - M.occupant_message("You push [src] out of the way.") visible_message("[M] pushes [src] out of the way.") return diff --git a/code/modules/mob/living/silicon/pai/life.dm b/code/modules/mob/living/silicon/pai/life.dm index 874828a6f69..cfcf71eeffb 100644 --- a/code/modules/mob/living/silicon/pai/life.dm +++ b/code/modules/mob/living/silicon/pai/life.dm @@ -19,9 +19,3 @@ stat = CONSCIOUS return health = maxHealth - getBruteLoss() - getFireLoss() - -/mob/living/silicon/pai/proc/follow_pai() - while(card) - loc = get_turf(card) - sleep(5) - qdel(src) //if there's no pAI we shouldn't exist diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 53d4fec79f6..58f7478a67e 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -4,7 +4,6 @@ mouse_opacity = 0 density = 0 mob_size = 0 - invisibility = 101 var/network = "SS13" var/obj/machinery/camera/current = null @@ -51,7 +50,7 @@ /mob/living/silicon/pai/New(var/obj/item/device/paicard) make_laws() canmove = 0 - src.loc = get_turf(paicard) + src.loc = paicard card = paicard sradio = new(src) if(card) @@ -66,7 +65,6 @@ pda.owner = text("[]", src) pda.name = pda.owner + " (" + pda.ownjob + ")" - follow_pai() ..() /mob/living/silicon/pai/make_laws() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 918437895bb..5424d83628d 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -75,14 +75,18 @@ var/next_mob_id = 0 src << msg return -// Show a message to all mobs in sight of this one +// Show a message to all mobs who sees the src mob and the src mob itself // This would be for visible actions by the src mob // message is the message output to anyone who can see e.g. "[src] does something!" // self_message (optional) is what the src mob sees e.g. "You do something!" // blind_message (optional) is what blind people will hear e.g. "You hear something!" /mob/visible_message(var/message, var/self_message, var/blind_message) - for(var/mob/M in viewers(src)) + var/list/atom_viewers = list() + for(var/atom/movable/A in view(src)) + atom_viewers |= recursive_hear_check(A) + atom_viewers |= src + for(var/mob/M in atom_viewers) if(M.see_invisible < invisibility) continue //can't view the invisible var/msg = message @@ -90,12 +94,16 @@ var/next_mob_id = 0 msg = self_message M.show_message( msg, 1, blind_message, 2) -// Show a message to all mobs in sight of this atom +// Show a message to all mobs who sees this atom // Use for objects performing visible actions // message is output to anyone who can see, e.g. "The [src] does something!" // blind_message (optional) is what blind people will hear e.g. "You hear something!" + /atom/proc/visible_message(var/message, var/blind_message) - for(var/mob/M in viewers(src)) + var/list/atom_viewers = list() + for(var/atom/movable/A in view(src)) + atom_viewers |= recursive_hear_check(A) + for(var/mob/M in atom_viewers) M.show_message( message, 1, blind_message, 2) // Show a message to all mobs in earshot of this one @@ -882,7 +890,7 @@ var/list/slot_equipment_priority = list( \ /mob/proc/get_ghost(even_if_they_cant_reenter = 0) if(mind) - for(var/mob/dead/observer/G in player_list) + for(var/mob/dead/observer/G in dead_mob_list) if(G.mind == mind) if(G.can_reenter_corpse || even_if_they_cant_reenter) return G diff --git a/code/modules/reagents/Chemistry-Holder.dm b/code/modules/reagents/Chemistry-Holder.dm index 9e4da4d8a40..6001a9c0fa1 100644 --- a/code/modules/reagents/Chemistry-Holder.dm +++ b/code/modules/reagents/Chemistry-Holder.dm @@ -282,7 +282,7 @@ datum/reagents/proc/handle_reactions() ME2.Uses-- if(ME2.Uses <= 0) // give the notification that the slime core is dead for(var/mob/M in seen) - M << "\icon[my_atom] The [my_atom]'s power is consumed in the reaction." + M << "\icon[my_atom] \The [my_atom]'s power is consumed in the reaction." ME2.name = "\improper used slime extract" ME2.desc = "This extract has been used up." From a6b24162e18df1b7bf08a8783fd295b3ce469c5f Mon Sep 17 00:00:00 2001 From: phil235 Date: Thu, 4 Dec 2014 13:02:53 +0100 Subject: [PATCH 2/4] Fixes visible_message's blind_message only being heard by actual blind mobs and not by other mobs who just cannot see the src in the dark. Now all non-deaf people in hearing range who did not get the "visible" message will instead get the "audible" blind_message. --- code/modules/mob/mob.dm | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 5424d83628d..7cff1b51ad7 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -92,7 +92,15 @@ var/next_mob_id = 0 var/msg = message if(self_message && M==src) msg = self_message - M.show_message( msg, 1, blind_message, 2) + M.show_message( msg, 1) + if(blind_message) + var/list/atom_hearers = list() + for(var/atom/movable/O in get_hearers_in_view(7, src)) + if(O in atom_viewers) + continue + atom_hearers |= O + for(var/mob/MOB in atom_hearers) + MOB.show_message(blind_message, 2) // Show a message to all mobs who sees this atom // Use for objects performing visible actions @@ -104,7 +112,15 @@ var/next_mob_id = 0 for(var/atom/movable/A in view(src)) atom_viewers |= recursive_hear_check(A) for(var/mob/M in atom_viewers) - M.show_message( message, 1, blind_message, 2) + M.show_message( message, 1) + if(blind_message) + var/list/atom_hearers = list() + for(var/atom/movable/O in get_hearers_in_view(7, src)) + if(O in atom_viewers) + continue + atom_hearers |= O + for(var/mob/MOB in atom_hearers) + MOB.show_message(blind_message, 2) // Show a message to all mobs in earshot of this one // This would be for audible actions by the src mob From 2481bef95f8d265908cdcbc0adad97398f220b07 Mon Sep 17 00:00:00 2001 From: phil235 Date: Sat, 20 Dec 2014 17:29:23 +0100 Subject: [PATCH 3/4] Changed the visible_message procs and audible_message procs, they now use the new get_player_mob_hearers_in_view() proc instead of a recursive proc. I removed some duplicated code from tools/tools.dm Fixed two typos with span class. --- code/__HELPERS/game.dm | 18 ++++ code/game/mecha/equipment/tools/tools.dm | 105 ++++++++--------------- code/modules/mob/living/emote.dm | 3 +- code/modules/mob/mob.dm | 70 ++++++++------- code/modules/projectiles/projectile.dm | 4 +- 5 files changed, 95 insertions(+), 105 deletions(-) diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 8d30dd0343a..2e9d9e87b8b 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -210,6 +210,24 @@ return hear +/proc/get_player_mob_hearers_in_view(var/range,var/atom/source) + //Returns a list of player controlled mobs in view(R) from source (ignoring luminosity). Used in visible_message and audible_message procs. + var/turf/T = get_turf(source) + var/list/mob_hear = list() + + if(!T) + return mob_hear + + var/lum = source.luminosity + source.luminosity = 6 + for(var/mob/M in player_list) + var/turf/TF = get_turf(M) + if(source in view(range, TF)) + mob_hear |= M + source.luminosity = lum + return mob_hear + + /proc/get_mobs_in_radio_ranges(var/list/obj/item/device/radio/radios) set background = BACKGROUND_ENABLED diff --git a/code/game/mecha/equipment/tools/tools.dm b/code/game/mecha/equipment/tools/tools.dm index dc711bb3874..7105b6d5234 100644 --- a/code/game/mecha/equipment/tools/tools.dm +++ b/code/game/mecha/equipment/tools/tools.dm @@ -26,13 +26,14 @@ cargo_holder = null /obj/item/mecha_parts/mecha_equipment/tool/hydraulic_clamp/action(atom/target) - if(!action_checks(target)) return - if(!cargo_holder) return + if(!action_checks(target)) + return + if(!cargo_holder) + return if(istype(target,/obj)) var/obj/O = target if(!O.anchored) if(cargo_holder.cargo.len < cargo_holder.cargo_capacity) - occupant_message("You lift [target] and start to load it into cargo compartment.") chassis.visible_message("[chassis] lifts [target] and starts to load it into cargo compartment.") set_ready_state(0) chassis.use_power(energy_drain) @@ -46,12 +47,12 @@ occupant_message("[target] successfully loaded.") log_message("Loaded [O]. Cargo compartment capacity: [cargo_holder.cargo_capacity - cargo_holder.cargo.len]") else - occupant_message("You must hold still while handling objects.") + occupant_message("You must hold still while handling objects.") O.anchored = initial(O.anchored) else - occupant_message("Not enough room in cargo compartment.") + occupant_message("Not enough room in cargo compartment.") else - occupant_message("[target] is firmly secured.") + occupant_message("[target] is firmly secured.") else if(istype(target,/mob/living)) var/mob/living/M = target @@ -62,8 +63,9 @@ return M.adjustOxyLoss(round(dam_force/2)) M.updatehealth() - occupant_message("You squeeze [target] with [src.name]. Something cracks.") - chassis.visible_message("[chassis] squeezes [target].") + target.visible_message("[chassis] squeezes [target].", \ + "[chassis] squeezes [target].",\ + "You hear something crack") add_logs(chassis.occupant, M, "attacked", object="[name]", addition="(INTENT: [uppertext(chassis.occupant.a_intent)]) (DAMTYE: [uppertext(damtype)])") else step_away(M,chassis) @@ -83,20 +85,28 @@ force = 15 /obj/item/mecha_parts/mecha_equipment/tool/drill/action(atom/target) - if(!action_checks(target)) return + if(!action_checks(target)) + return if(isobj(target)) var/obj/target_obj = target - if(!target_obj.vars.Find("unacidable") || target_obj.unacidable) return + if(target_obj.unacidable) + return set_ready_state(0) chassis.use_power(energy_drain) - chassis.visible_message("[chassis] starts to drill [target]", "You hear the drill.") - occupant_message("You start to drill [target]") + target.visible_message("[chassis] starts to drill [target]", \ + "[chassis] starts to drill [target]", \ + "You hear drilling.") var/T = chassis.loc var/C = target.loc //why are these backwards? we may never know -Pete if(do_after_cooldown(target)) if(T == chassis.loc && src == chassis.selected) if(istype(target, /turf/simulated/wall/r_wall)) - occupant_message("[target] is too durable to drill through.") + if(istype(src , /obj/item/mecha_parts/mecha_equipment/tool/drill/diamonddrill)) + if(do_after_cooldown(target))//To slow down how fast mechs can drill through the station + log_message("Drilled through [target]") + target.ex_act(3) + else + occupant_message("[target] is too durable to drill through.") else if(istype(target, /turf/simulated/mineral)) for(var/turf/simulated/mineral/M in range(chassis,1)) if(get_dir(chassis,M)&chassis.dir) @@ -122,7 +132,10 @@ else if(target.loc == C) log_message("Drilled through [target]") if(isliving(target)) - drill_mob(target, chassis.occupant) + if(istype(src , /obj/item/mecha_parts/mecha_equipment/tool/drill/diamonddrill)) + drill_mob(target, chassis.occupant, 120) + else + drill_mob(target, chassis.occupant) else target.ex_act(2) return 1 @@ -156,50 +169,6 @@ equip_cooldown = 20 force = 15 -/obj/item/mecha_parts/mecha_equipment/tool/drill/diamonddrill/action(atom/target) - if(!action_checks(target)) return - if(isobj(target)) - var/obj/target_obj = target - if(target_obj.unacidable) return - set_ready_state(0) - chassis.use_power(energy_drain) - chassis.visible_message("[chassis] starts to drill [target]", "You hear the drill.") - occupant_message("You start to drill [target]") - var/T = chassis.loc - var/C = target.loc //why are these backwards? we may never know -Pete - if(do_after_cooldown(target)) - if(T == chassis.loc && src == chassis.selected) - if(istype(target, /turf/simulated/wall/r_wall)) - if(do_after_cooldown(target))//To slow down how fast mechs can drill through the station - log_message("Drilled through [target]") - target.ex_act(3) - else if(istype(target, /turf/simulated/mineral)) - for(var/turf/simulated/mineral/M in range(chassis,1)) - if(get_dir(chassis,M)&chassis.dir) - M.gets_drilled() - log_message("Drilled through [target]") - if(locate(/obj/item/mecha_parts/mecha_equipment/tool/hydraulic_clamp) in chassis.equipment) - var/obj/structure/ore_box/ore_box = locate(/obj/structure/ore_box) in chassis:cargo - if(ore_box) - for(var/obj/item/weapon/ore/ore in range(chassis,1)) - if(get_dir(chassis,ore)&chassis.dir) - ore.Move(ore_box) - else if(istype(target,/turf/simulated/floor/plating/asteroid)) - for(var/turf/simulated/floor/plating/asteroid/M in range(target,1)) - M.gets_dug() - log_message("Drilled through [target]") - if(locate(/obj/item/mecha_parts/mecha_equipment/tool/hydraulic_clamp) in chassis.equipment) - var/obj/structure/ore_box/ore_box = locate(/obj/structure/ore_box) in chassis:cargo - if(ore_box) - for(var/obj/item/weapon/ore/ore in range(target,1)) - ore.Move(ore_box) - else if(target.loc == C) - log_message("Drilled through [target]") - if(isliving(target)) - drill_mob(target, chassis.occupant, 120) - else - target.ex_act(2) - return 1 /obj/item/mecha_parts/mecha_equipment/tool/drill/diamonddrill/can_attach(obj/mecha/M as obj) if(..()) @@ -756,7 +725,6 @@ if(!action_checks(src)) return chassis.dynbulletdamage(Proj) if(prob(chassis.deflect_chance*deflect_coeff)) - chassis.occupant_message("The armor deflects incoming projectile.") chassis.visible_message("The [chassis.name] armor deflects the projectile") chassis.log_append_to_last("Armor saved.") else @@ -772,7 +740,6 @@ if(!action_checks(A)) return chassis.dynhitby(A) if(prob(chassis.deflect_chance*deflect_coeff) || istype(A, /mob/living) || istype(A, /obj/item/mecha_parts/mecha_tracking)) - chassis.occupant_message("The [A] bounces off the armor.") chassis.visible_message("The [A] bounces off the [chassis] armor") chassis.log_append_to_last("Armor saved.") if(istype(A, /mob/living)) @@ -1206,7 +1173,6 @@ var/obj/O = target if(!O.anchored) if(cargo_holder.cargo.len < cargo_holder.cargo_capacity) - chassis.occupant_message("You lift [target] and start to load it into cargo compartment.") chassis.visible_message("[chassis] lifts [target] and starts to load it into cargo compartment.") set_ready_state(0) chassis.use_power(energy_drain) @@ -1220,26 +1186,25 @@ chassis.occupant_message("[target] successfully loaded.") chassis.log_message("Loaded [O]. Cargo compartment capacity: [cargo_holder.cargo_capacity - cargo_holder.cargo.len]") else - chassis.occupant_message("You must hold still while handling objects.") + chassis.occupant_message("You must hold still while handling objects.") O.anchored = initial(O.anchored) else - chassis.occupant_message("Not enough room in cargo compartment.") + chassis.occupant_message("Not enough room in cargo compartment.") else - chassis.occupant_message("[target] is firmly secured.") + chassis.occupant_message("[target] is firmly secured.") else if(istype(target,/mob/living)) var/mob/living/M = target if(M.stat>1) return if(chassis.occupant.a_intent == "harm") - chassis.occupant_message("You obliterate [target] with [src.name], leaving blood and guts everywhere.") - chassis.visible_message("[chassis] destroys [target] in an unholy fury.") + target.visible_message("[chassis] destroys [target] in an unholy fury.", \ + "[chassis] destroys [target] in an unholy fury.") if(chassis.occupant.a_intent == "disarm") - chassis.occupant_message("You tear [target]'s limbs off with [src.name].") - chassis.visible_message("[chassis] rips [target]'s arms off.") + target.visible_message("[chassis] rips [target]'s arms off.", \ + "[chassis] rips [target]'s arms off.") else step_away(M,chassis) - chassis.occupant_message("You smash into [target], sending them flying.") - chassis.visible_message("[chassis] tosses [target] like a piece of paper.") + target.visible_message("[chassis] tosses [target] like a piece of paper.") set_ready_state(0) chassis.use_power(energy_drain) do_after_cooldown() diff --git a/code/modules/mob/living/emote.dm b/code/modules/mob/living/emote.dm index ed75ad5e894..cb4c51e3618 100644 --- a/code/modules/mob/living/emote.dm +++ b/code/modules/mob/living/emote.dm @@ -267,7 +267,8 @@ for(var/mob/M in dead_mob_list) if(!M.client || istype(M, /mob/new_player)) continue //skip monkeys, leavers and new players - if(M.stat == DEAD && (M.client.prefs.toggles & CHAT_GHOSTSIGHT) && !(M in viewers(src,null))) + var/T = get_turf(src) + if(M.stat == DEAD && (M.client.prefs.toggles & CHAT_GHOSTSIGHT) && !(M in viewers(T,null))) M.show_message(message) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 70ebc0eb515..15919d2eaf8 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -79,48 +79,54 @@ var/next_mob_id = 0 // This would be for visible actions by the src mob // message is the message output to anyone who can see e.g. "[src] does something!" // self_message (optional) is what the src mob sees e.g. "You do something!" -// blind_message (optional) is what blind people will hear e.g. "You hear something!" +// blind_message (optional) is what blinded people will hear e.g. "You hear something!" /mob/visible_message(var/message, var/self_message, var/blind_message) - var/list/atom_viewers = list() - for(var/atom/movable/A in view(src)) - atom_viewers |= recursive_hear_check(A) - atom_viewers |= src - for(var/mob/M in atom_viewers) - if(M.see_invisible < invisibility) + var/list/mob_viewers = list() + for(var/mob/M in player_list) + var/turf/T = get_turf(M) + if( (src in view(T)) || M == src) + mob_viewers |= M + for(var/mob/O in mob_viewers) + if(O.see_invisible < invisibility) continue //can't view the invisible - var/msg = message - if(self_message && M==src) - msg = self_message - M.show_message( msg, 1) + if(O == src && stat != UNCONSCIOUS && !sleeping) + var/msg = message + if(self_message) + msg = self_message + O << msg + else + O.show_message( message, 1, blind_message, 2) if(blind_message) - var/list/atom_hearers = list() - for(var/atom/movable/O in get_hearers_in_view(7, src)) - if(O in atom_viewers) - continue - atom_hearers |= O - for(var/mob/MOB in atom_hearers) - MOB.show_message(blind_message, 2) + var/list/mob_hearers = list() + for(var/mob/MOB in get_player_mob_hearers_in_view(7, src)) + if(MOB in mob_viewers) + continue //if we get the normal message, we don't get the blind_message. + mob_hearers |= MOB + for(var/mob/A in mob_hearers) + A.show_message( blind_message, 2) // Show a message to all mobs who sees this atom // Use for objects performing visible actions // message is output to anyone who can see, e.g. "The [src] does something!" -// blind_message (optional) is what blind people will hear e.g. "You hear something!" +// blind_message (optional) is what blinded people will hear e.g. "You hear something!" /atom/proc/visible_message(var/message, var/blind_message) - var/list/atom_viewers = list() - for(var/atom/movable/A in view(src)) - atom_viewers |= recursive_hear_check(A) - for(var/mob/M in atom_viewers) - M.show_message( message, 1) + var/list/mob_viewers = list() + for(var/mob/M in player_list) + var/turf/T = get_turf(M) + if(src in view(T)) + mob_viewers |= M + for(var/mob/O in mob_viewers) + O.show_message( message, 1, blind_message, 2) if(blind_message) - var/list/atom_hearers = list() - for(var/atom/movable/O in get_hearers_in_view(7, src)) - if(O in atom_viewers) + var/list/mob_hearers = list() + for(var/mob/MOB in get_player_mob_hearers_in_view(7, src)) + if(MOB in mob_viewers) continue - atom_hearers |= O - for(var/mob/MOB in atom_hearers) - MOB.show_message(blind_message, 2) + mob_hearers |= MOB + for(var/mob/A in mob_hearers) + A.show_message( blind_message, 2) // Show a message to all mobs in earshot of this one // This would be for audible actions by the src mob @@ -134,7 +140,7 @@ var/next_mob_id = 0 if(hearing_distance) range = hearing_distance var/msg = message - for(var/mob/M in get_hearers_in_view(range, src)) + for(var/mob/M in get_player_mob_hearers_in_view(range, src)) if(self_message && M==src) msg = self_message M.show_message( msg, 2, deaf_message, 1) @@ -149,7 +155,7 @@ var/next_mob_id = 0 var/range = 7 if(hearing_distance) range = hearing_distance - for(var/mob/M in get_hearers_in_view(range, src)) + for(var/mob/M in get_player_mob_hearers_in_view(range, src)) M.show_message( message, 2, deaf_message, 1) /mob/proc/movement_delay() diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index d2dc5b61e67..268f07767ee 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -74,8 +74,8 @@ if(hitsound) var/volume = vol_by_damage() playsound(loc, hitsound, volume, 1, -1) - M.visible_message("[M] is hit by \a [src] in the [parse_zone(def_zone)]!", \ - "[M] is hit by \a [src] in the [parse_zone(def_zone)]!") //X has fired Y is now given by the guns so you cant tell who shot you if you could not see the shooter + M.visible_message("[M] is hit by \a [src] in the [parse_zone(def_zone)]!", \ + "[M] is hit by \a [src] in the [parse_zone(def_zone)]!") //X has fired Y is now given by the guns so you cant tell who shot you if you could not see the shooter add_logs(firer, M, "shot", object="[src]", addition=reagent_note) var/turf/new_loc = get_turf(A) From a89711b6e4e1236796316c420016496a22babbe3 Mon Sep 17 00:00:00 2001 From: phil235 Date: Mon, 22 Dec 2014 22:37:16 +0100 Subject: [PATCH 4/4] Reverting back to using the recursive get_hearers_in_view proc. --- code/__HELPERS/game.dm | 18 ----------- code/modules/mob/mob.dm | 72 +++++++++++++++++++---------------------- 2 files changed, 33 insertions(+), 57 deletions(-) diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 2e9d9e87b8b..8d30dd0343a 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -210,24 +210,6 @@ return hear -/proc/get_player_mob_hearers_in_view(var/range,var/atom/source) - //Returns a list of player controlled mobs in view(R) from source (ignoring luminosity). Used in visible_message and audible_message procs. - var/turf/T = get_turf(source) - var/list/mob_hear = list() - - if(!T) - return mob_hear - - var/lum = source.luminosity - source.luminosity = 6 - for(var/mob/M in player_list) - var/turf/TF = get_turf(M) - if(source in view(range, TF)) - mob_hear |= M - source.luminosity = lum - return mob_hear - - /proc/get_mobs_in_radio_ranges(var/list/obj/item/device/radio/radios) set background = BACKGROUND_ENABLED diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 15919d2eaf8..cc57e5b0daa 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -78,55 +78,49 @@ var/next_mob_id = 0 // Show a message to all mobs who sees the src mob and the src mob itself // This would be for visible actions by the src mob // message is the message output to anyone who can see e.g. "[src] does something!" -// self_message (optional) is what the src mob sees e.g. "You do something!" -// blind_message (optional) is what blinded people will hear e.g. "You hear something!" +// self_message (optional) is what the src mob sees e.g. "You do something!" +// blind_message (optional) is what blind people will hear e.g. "You hear something!" /mob/visible_message(var/message, var/self_message, var/blind_message) - var/list/mob_viewers = list() - for(var/mob/M in player_list) - var/turf/T = get_turf(M) - if( (src in view(T)) || M == src) - mob_viewers |= M - for(var/mob/O in mob_viewers) - if(O.see_invisible < invisibility) + var/list/atom_viewers = list() + for(var/atom/movable/A in view(src)) + atom_viewers |= recursive_hear_check(A) + atom_viewers |= src + for(var/mob/M in atom_viewers) + if(M.see_invisible < invisibility) continue //can't view the invisible - if(O == src && stat != UNCONSCIOUS && !sleeping) - var/msg = message - if(self_message) - msg = self_message - O << msg - else - O.show_message( message, 1, blind_message, 2) + var/msg = message + if(self_message && M==src) + msg = self_message + M.show_message( msg, 1) if(blind_message) - var/list/mob_hearers = list() - for(var/mob/MOB in get_player_mob_hearers_in_view(7, src)) - if(MOB in mob_viewers) - continue //if we get the normal message, we don't get the blind_message. - mob_hearers |= MOB - for(var/mob/A in mob_hearers) - A.show_message( blind_message, 2) + var/list/atom_hearers = list() + for(var/atom/movable/O in get_hearers_in_view(7, src)) + if(O in atom_viewers) + continue + atom_hearers |= O + for(var/mob/MOB in atom_hearers) + MOB.show_message(blind_message, 2) // Show a message to all mobs who sees this atom // Use for objects performing visible actions // message is output to anyone who can see, e.g. "The [src] does something!" -// blind_message (optional) is what blinded people will hear e.g. "You hear something!" +// blind_message (optional) is what blind people will hear e.g. "You hear something!" /atom/proc/visible_message(var/message, var/blind_message) - var/list/mob_viewers = list() - for(var/mob/M in player_list) - var/turf/T = get_turf(M) - if(src in view(T)) - mob_viewers |= M - for(var/mob/O in mob_viewers) - O.show_message( message, 1, blind_message, 2) + var/list/atom_viewers = list() + for(var/atom/movable/A in view(src)) + atom_viewers |= recursive_hear_check(A) + for(var/mob/M in atom_viewers) + M.show_message( message, 1) if(blind_message) - var/list/mob_hearers = list() - for(var/mob/MOB in get_player_mob_hearers_in_view(7, src)) - if(MOB in mob_viewers) + var/list/atom_hearers = list() + for(var/atom/movable/O in get_hearers_in_view(7, src)) + if(O in atom_viewers) continue - mob_hearers |= MOB - for(var/mob/A in mob_hearers) - A.show_message( blind_message, 2) + atom_hearers |= O + for(var/mob/MOB in atom_hearers) + MOB.show_message(blind_message, 2) // Show a message to all mobs in earshot of this one // This would be for audible actions by the src mob @@ -140,7 +134,7 @@ var/next_mob_id = 0 if(hearing_distance) range = hearing_distance var/msg = message - for(var/mob/M in get_player_mob_hearers_in_view(range, src)) + for(var/mob/M in get_hearers_in_view(range, src)) if(self_message && M==src) msg = self_message M.show_message( msg, 2, deaf_message, 1) @@ -155,7 +149,7 @@ var/next_mob_id = 0 var/range = 7 if(hearing_distance) range = hearing_distance - for(var/mob/M in get_player_mob_hearers_in_view(range, src)) + for(var/mob/M in get_hearers_in_view(range, src)) M.show_message( message, 2, deaf_message, 1) /mob/proc/movement_delay()