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.
This commit is contained in:
phil235
2014-12-04 01:08:04 +01:00
parent b9b73531a6
commit d545eb7f9f
12 changed files with 19 additions and 42 deletions
+1 -1
View File
@@ -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("<span class='userdanger'>[src] bursts!</span>");
visible_message("<span class='danger'>[src] bursts!</span>");
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)
-1
View File
@@ -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("<span class='danger'>You hit [src].</span>")
visible_message("<span class='danger'>[src] has been hit by [M.name].</span>")
take_damage(M.force)
return
+1 -17
View File
@@ -320,7 +320,6 @@ obj/mecha/proc/can_use(mob/user)
playsound(src, 'sound/items/Welder.ogg', 50, 1)
else
return
M.occupant_message("<span class='danger'>You hit [src].</span>")
visible_message("<span class='danger'>[src] has been hit by [M.name].</span>")
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("<span class='userdanger'>Taking damage!</span>")
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("<span class='danger'>[user] hits [src.name], doing some damage.</span>", "<span class='danger'>You hit [src.name] with all your might. The metal creaks and bends.</span>")
src.occupant_message("<span class='userdanger'>[user] hits [src.name], doing some damage.</span>")
else
user.visible_message("<span class='danger'>[user] hits [src.name]. Nothing happens</span>","<span class='danger'>You hit [src.name] with no visible effect.</span>")
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 << "<span class='danger'>You slash at the armored suit!</span>"
visible_message("<span class='danger'>The [user] slashes at [src.name]'s armor!</span>")
src.occupant_message("<span class='userdanger'>The [user] slashes at [src.name]'s armor!</span>")
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("<span class='notice'>The [user]'s claws are stopped by the armor.</span>")
visible_message("<span class='notice'>The [user] rebounds off [src.name]'s armor!</span>")
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("<span class='danger'>[user] [user.attacktext] [src]!</span>")
src.occupant_message("<span class='userdanger'>[user] [user.attacktext] [src]!</span>")
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("<span class='notice'>[user]'s attack is stopped by the armor.</span>")
visible_message("<span class='notice'>The [user] rebounds off [src.name]'s armor!</span>")
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("<span class='notice'>[A] bounces off the armor.</span>")
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("<span class='userdanger'>[src.name] is hit by [A].</span>")
src.visible_message("<span class='danger'>[src.name] is hit by [A].</span>")
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("<span class='notice'>The armor deflects incoming projectile.</span>")
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("<span class='userdanger'>[src.name] is hit by [Proj]!</span>")
src.visible_message("<span class='danger'>[src.name] is hit by [Proj].</span>")
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 << "<span class='danger'>The [W] bounces off [src.name] armor.</span>"
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("<span class='userdanger'>[user] hits [src] with [W].</span>")
user.visible_message("<span class='danger'>[user] hits [src] with [W].</span>", "<span class='danger'>You hit [src] with [W].</span>")
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))
+2 -2
View File
@@ -67,7 +67,7 @@
/obj/item/toy/balloon/throw_impact(atom/hit_atom)
if(src.reagents.total_volume >= 1)
src.visible_message("<span class='danger'>The [src] bursts!</span>","You hear a pop and a splash.")
src.visible_message("<span class='danger'>\The [src] bursts!</span>","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("<span class='notice'>[user] draws a card from the deck.</span>", "<span class='notice'>You draw a card from the deck.</span>")
user.visible_message("<span class='notice'>[user] draws a card from the deck.</span>", "<span class='notice'>You draw a card from the deck.</span>")
if(cards.len > 26)
src.icon_state = "deck_[deckstyle]_full"
else if(cards.len > 10)
-1
View File
@@ -12,7 +12,6 @@
/obj/structure/mech_melee_attack(obj/mecha/M)
if(M.damtype == "brute")
M.occupant_message("<span class='danger'>You hit [src].</span>")
visible_message("<span class='danger'>[src] has been hit by [M.name].</span>")
return 1
return 0
-2
View File
@@ -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("<span class='danger'>You hit [src].</span>")
visible_message("<span class='danger'>[src] has been hit by [M.name].</span>")
if(prob(5) && M.force > 20)
dismantle_wall(1)
M.occupant_message("<span class='warning'>You smash through the wall.</span>")
visible_message("<span class='warning'>[src.name] smashes through the wall!</span>")
playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1)
@@ -398,7 +398,6 @@ emp_act
update_damage_overlays(0)
updatehealth()
M.occupant_message("<span class='danger'>You hit [src].</span>")
visible_message("<span class='danger'>[src] has been hit by [M.name].</span>", \
"<span class='userdanger'>[src] has been hit by [M.name].</span>")
add_logs(M.occupant, src, "attacked", object=M, addition="(INTENT: [uppertext(M.occupant.a_intent)]) (DAMTYPE: [uppertext(M.damtype)])")
@@ -86,14 +86,12 @@ proc/vol_by_throwforce_and_or_w_class(var/obj/item/I)
else
return
updatehealth()
M.occupant_message("<span class='danger'>You hit [src].</span>")
visible_message("<span class='danger'>[src] has been hit by [M.name].</span>", \
"<span class='userdanger'>[src] has been hit by [M.name].</span>")
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("<span class='warning'>You push [src] out of the way.</span>")
visible_message("<span class='warning'>[M] pushes [src] out of the way.</span>")
return
@@ -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
+1 -3
View File
@@ -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()
+13 -5
View File
@@ -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
+1 -1
View File
@@ -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 << "<span class='notice'>\icon[my_atom] The [my_atom]'s power is consumed in the reaction.</span>"
M << "<span class='notice'>\icon[my_atom] \The [my_atom]'s power is consumed in the reaction.</span>"
ME2.name = "\improper used slime extract"
ME2.desc = "This extract has been used up."