listener update
This commit is contained in:
+13
-126
@@ -19,9 +19,11 @@
|
||||
var/fire = FALSE
|
||||
///How many fire alarm sources do we have?
|
||||
var/triggered_firealarms = 0
|
||||
///Whether there is an atmos alarm in this area
|
||||
var/atmosalm = FALSE
|
||||
var/poweralm = FALSE
|
||||
///Alarm type to count of sources. Not usable for ^ because we handle fires differently
|
||||
var/list/active_alarms = list()
|
||||
///We use this just for fire alarms, because they're area based right now so one alarm going poof shouldn't prevent you from clearing your alarms listing
|
||||
var/datum/alarm_handler/alarm_manager
|
||||
|
||||
var/lightswitch = TRUE
|
||||
|
||||
/// All beauty in this area combined, only includes indoor area.
|
||||
@@ -186,6 +188,8 @@ GLOBAL_LIST_EMPTY(teleportlocs)
|
||||
if (area_flags & UNIQUE_AREA)
|
||||
GLOB.areas_by_type[type] = src
|
||||
|
||||
alarm_manager = new(src) // just in case
|
||||
|
||||
if(!minimap_color) // goes in New() because otherwise it doesn't fucking work
|
||||
// generate one using the icon_state
|
||||
if(icon_state && icon_state != "unknown")
|
||||
@@ -324,86 +328,12 @@ GLOBAL_LIST_EMPTY(teleportlocs)
|
||||
A.power_environ = FALSE
|
||||
A.power_change()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
QDEL_NULL(alarm_manager)
|
||||
return ..()
|
||||
|
||||
/**
|
||||
* Generate a power alert for this area
|
||||
*
|
||||
* Sends to all ai players, alert consoles, drones and alarm monitor programs in the world
|
||||
* Try to close all the firedoors in the area
|
||||
*/
|
||||
/area/proc/poweralert(set_alarm, obj/source)
|
||||
if (area_flags & NO_ALERTS)
|
||||
return
|
||||
if (set_alarm != poweralm)
|
||||
poweralm = set_alarm
|
||||
if(istype(source)) //Only report power alarms on the z-level where the source is located.
|
||||
for (var/item in GLOB.silicon_mobs)
|
||||
var/mob/living/silicon/aiPlayer = item
|
||||
if (set_alarm)
|
||||
aiPlayer.triggerAlarm("Power", src, cameras, source)
|
||||
else
|
||||
aiPlayer.cancelAlarm("Power", src, source)
|
||||
|
||||
for (var/item in GLOB.alert_consoles)
|
||||
var/obj/machinery/computer/station_alert/a = item
|
||||
if (set_alarm)
|
||||
a.triggerAlarm("Power", src, cameras, source)
|
||||
else
|
||||
a.cancelAlarm("Power", src, source)
|
||||
|
||||
for (var/item in GLOB.drones_list)
|
||||
var/mob/living/simple_animal/drone/D = item
|
||||
if (set_alarm)
|
||||
D.triggerAlarm("Power", src, cameras, source)
|
||||
else
|
||||
D.cancelAlarm("Power", src, source)
|
||||
for(var/item in GLOB.alarmdisplay)
|
||||
var/datum/computer_file/program/alarm_monitor/p = item
|
||||
if (set_alarm)
|
||||
p.triggerAlarm("Power", src, cameras, source)
|
||||
else
|
||||
p.cancelAlarm("Power", src, source)
|
||||
|
||||
/area/proc/atmosalert(danger_level, obj/source)
|
||||
if (area_flags & NO_ALERTS)
|
||||
return
|
||||
if(danger_level != atmosalm)
|
||||
if (danger_level==2)
|
||||
|
||||
for (var/item in GLOB.silicon_mobs)
|
||||
var/mob/living/silicon/aiPlayer = item
|
||||
aiPlayer.triggerAlarm("Atmosphere", src, cameras, source)
|
||||
for (var/item in GLOB.alert_consoles)
|
||||
var/obj/machinery/computer/station_alert/a = item
|
||||
a.triggerAlarm("Atmosphere", src, cameras, source)
|
||||
for (var/item in GLOB.drones_list)
|
||||
var/mob/living/simple_animal/drone/D = item
|
||||
D.triggerAlarm("Atmosphere", src, cameras, source)
|
||||
for(var/item in GLOB.alarmdisplay)
|
||||
var/datum/computer_file/program/alarm_monitor/p = item
|
||||
p.triggerAlarm("Atmosphere", src, cameras, source)
|
||||
|
||||
else if (src.atmosalm == 2)
|
||||
for (var/item in GLOB.silicon_mobs)
|
||||
var/mob/living/silicon/aiPlayer = item
|
||||
aiPlayer.cancelAlarm("Atmosphere", src, source)
|
||||
for (var/item in GLOB.alert_consoles)
|
||||
var/obj/machinery/computer/station_alert/a = item
|
||||
a.cancelAlarm("Atmosphere", src, source)
|
||||
for (var/item in GLOB.drones_list)
|
||||
var/mob/living/simple_animal/drone/D = item
|
||||
D.cancelAlarm("Atmosphere", src, source)
|
||||
for(var/item in GLOB.alarmdisplay)
|
||||
var/datum/computer_file/program/alarm_monitor/p = item
|
||||
p.cancelAlarm("Atmosphere", src, source)
|
||||
|
||||
atmosalm = danger_level
|
||||
for(var/i in sub_areas)
|
||||
var/area/A = i
|
||||
A.atmosalm = danger_level
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/area/proc/ModifyFiredoors(opening)
|
||||
if(firedoors)
|
||||
firedoors_last_closed_on = world.time
|
||||
@@ -429,19 +359,7 @@ GLOBAL_LIST_EMPTY(teleportlocs)
|
||||
if (!fire)
|
||||
set_fire_alarm_effects(TRUE)
|
||||
ModifyFiredoors(FALSE)
|
||||
if (!(area_flags & NO_ALERTS)) //Check here instead at the start of the proc so that fire alarms can still work locally even in areas that don't send alerts
|
||||
for (var/item in GLOB.alert_consoles)
|
||||
var/obj/machinery/computer/station_alert/a = item
|
||||
a.triggerAlarm("Fire", src, cameras, source)
|
||||
for (var/item in GLOB.silicon_mobs)
|
||||
var/mob/living/silicon/aiPlayer = item
|
||||
aiPlayer.triggerAlarm("Fire", src, cameras, source)
|
||||
for (var/item in GLOB.drones_list)
|
||||
var/mob/living/simple_animal/drone/D = item
|
||||
D.triggerAlarm("Fire", src, cameras, source)
|
||||
for(var/item in GLOB.alarmdisplay)
|
||||
var/datum/computer_file/program/alarm_monitor/p = item
|
||||
p.triggerAlarm("Fire", src, cameras, source)
|
||||
alarm_manager.send_alarm(ALARM_FIRE, source)
|
||||
|
||||
START_PROCESSING(SSobj, src)
|
||||
|
||||
@@ -460,35 +378,10 @@ GLOBAL_LIST_EMPTY(teleportlocs)
|
||||
if (should_reset_alarms) // if there's a source, make sure there's no fire alarms left
|
||||
set_fire_alarm_effects(FALSE)
|
||||
ModifyFiredoors(TRUE)
|
||||
|
||||
if (!(area_flags & NO_ALERTS)) //Check here instead at the start of the proc so that fire alarms can still work locally even in areas that don't send alerts
|
||||
for (var/item in GLOB.silicon_mobs)
|
||||
var/mob/living/silicon/aiPlayer = item
|
||||
aiPlayer.cancelAlarm("Fire", src, source)
|
||||
for (var/item in GLOB.alert_consoles)
|
||||
var/obj/machinery/computer/station_alert/a = item
|
||||
a.cancelAlarm("Fire", src, source)
|
||||
for (var/item in GLOB.drones_list)
|
||||
var/mob/living/simple_animal/drone/D = item
|
||||
D.cancelAlarm("Fire", src, source)
|
||||
for(var/item in GLOB.alarmdisplay)
|
||||
var/datum/computer_file/program/alarm_monitor/p = item
|
||||
p.cancelAlarm("Fire", src, source)
|
||||
alarm_manager.clear_alarm(ALARM_FIRE, source)
|
||||
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
|
||||
///Get rid of any dangling camera refs
|
||||
/area/proc/clear_camera(obj/machinery/camera/cam)
|
||||
LAZYREMOVE(cameras, cam)
|
||||
for (var/mob/living/silicon/aiPlayer as anything in GLOB.silicon_mobs)
|
||||
aiPlayer.freeCamera(src, cam)
|
||||
for (var/obj/machinery/computer/station_alert/comp as anything in GLOB.alert_consoles)
|
||||
comp.freeCamera(src, cam)
|
||||
for (var/mob/living/simple_animal/drone/drone_on as anything in GLOB.drones_list)
|
||||
drone_on.freeCamera(src, cam)
|
||||
for(var/datum/computer_file/program/alarm_monitor/monitor as anything in GLOB.alarmdisplay)
|
||||
monitor.freeCamera(src, cam)
|
||||
|
||||
/area/process()
|
||||
if(firedoors_last_closed_on + 100 < world.time) //every 10 seconds
|
||||
ModifyFiredoors(FALSE)
|
||||
@@ -506,14 +399,8 @@ GLOBAL_LIST_EMPTY(teleportlocs)
|
||||
//Trigger alarm effect
|
||||
set_fire_alarm_effects(TRUE)
|
||||
//Lockdown airlocks
|
||||
for(var/obj/machinery/door/DOOR in get_sub_areas_contents(src))
|
||||
close_and_lock_door(DOOR)
|
||||
|
||||
for (var/i in GLOB.silicon_mobs)
|
||||
var/mob/living/silicon/SILICON = i
|
||||
if(SILICON.triggerAlarm("Burglar", src, cameras, trigger))
|
||||
//Cancel silicon alert after 1 minute
|
||||
addtimer(CALLBACK(SILICON, TYPE_PROC_REF(/mob/living/silicon, cancelAlarm),"Burglar",src,trigger), 600)
|
||||
for(var/obj/machinery/door/door in get_sub_areas_contents(src))
|
||||
close_and_lock_door(door)
|
||||
|
||||
/area/proc/set_fire_alarm_effects(boolean)
|
||||
fire = boolean
|
||||
|
||||
@@ -99,7 +99,6 @@
|
||||
power_environ = FALSE
|
||||
power_equip = FALSE
|
||||
power_light = FALSE
|
||||
poweralm = FALSE
|
||||
|
||||
//ash walker nest
|
||||
/area/ruin/lavaland/unpowered/ash_walkers
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
var/upgrades = 0
|
||||
|
||||
var/internal_light = TRUE //Whether it can light up when an AI views it
|
||||
///Represents a signel source of camera alarms about movement or camera tampering
|
||||
var/datum/alarm_handler/alarm_manager
|
||||
|
||||
/obj/machinery/camera/preset/toxins //Bomb test site in space
|
||||
name = "Hardened Bomb-Test Camera"
|
||||
@@ -72,6 +74,8 @@
|
||||
if(mapload && is_station_level(z) && prob(3) && !start_active)
|
||||
toggle_cam()
|
||||
|
||||
alarm_manager = new(src)
|
||||
|
||||
/obj/machinery/camera/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock, idnum, override=FALSE)
|
||||
for(var/i in network)
|
||||
network -= i
|
||||
@@ -83,7 +87,8 @@
|
||||
GLOB.cameranet.cameras -= src
|
||||
cancelCameraAlarm()
|
||||
if(isarea(myarea))
|
||||
myarea.clear_camera(src)
|
||||
LAZYREMOVE(myarea.cameras, src)
|
||||
QDEL_NULL(alarm_manager)
|
||||
QDEL_NULL(assembly)
|
||||
if(bug)
|
||||
bug.bugged_cameras -= c_tag
|
||||
@@ -347,13 +352,11 @@
|
||||
|
||||
/obj/machinery/camera/proc/triggerCameraAlarm()
|
||||
alarm_on = TRUE
|
||||
for(var/mob/living/silicon/S in GLOB.silicon_mobs)
|
||||
S.triggerAlarm("Camera", get_area(src), list(src), src)
|
||||
alarm_manager.send_alarm(ALARM_CAMERA, src, src)
|
||||
|
||||
/obj/machinery/camera/proc/cancelCameraAlarm()
|
||||
alarm_on = FALSE
|
||||
for(var/mob/living/silicon/S in GLOB.silicon_mobs)
|
||||
S.cancelAlarm("Camera", get_area(src), src)
|
||||
alarm_manager.clear_alarm(ALARM_CAMERA)
|
||||
|
||||
/obj/machinery/camera/proc/can_use()
|
||||
if(!status)
|
||||
|
||||
@@ -52,21 +52,17 @@
|
||||
cancelAlarm()
|
||||
|
||||
/obj/machinery/camera/proc/cancelAlarm()
|
||||
if (detectTime == -1)
|
||||
for (var/i in GLOB.silicon_mobs)
|
||||
var/mob/living/silicon/aiPlayer = i
|
||||
if (status)
|
||||
aiPlayer.cancelAlarm("Motion", get_area(src), src)
|
||||
if (detectTime == -1 && status)
|
||||
alarm_manager.clear_alarm(ALARM_MOTION)
|
||||
detectTime = 0
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/camera/proc/triggerAlarm()
|
||||
if (!detectTime)
|
||||
return FALSE
|
||||
for (var/mob/living/silicon/aiPlayer in GLOB.player_list)
|
||||
if (status)
|
||||
aiPlayer.triggerAlarm("Motion", get_area(src), list(src), src)
|
||||
visible_message("<span class='warning'>A red light flashes on the [src]!</span>")
|
||||
if(status)
|
||||
if(alarm_manager.send_alarm(ALARM_MOTION, src, src))
|
||||
visible_message(span_warning("A red light flashes on the [src]!"))
|
||||
detectTime = -1
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -4,16 +4,17 @@
|
||||
icon_screen = "alert:0"
|
||||
icon_keyboard = "atmos_key"
|
||||
circuit = /obj/item/circuitboard/computer/stationalert
|
||||
var/alarms = list("Fire" = list(), "Atmosphere" = list(), "Power" = list())
|
||||
///Listens for alarms, provides the alarms list for our ui
|
||||
var/datum/alarm_listener/listener
|
||||
|
||||
light_color = LIGHT_COLOR_CYAN
|
||||
|
||||
/obj/machinery/computer/station_alert/Initialize(mapload)
|
||||
. = ..()
|
||||
GLOB.alert_consoles += src
|
||||
listener = new(list(ALARM_ATMOS, ALARM_FIRE, ALARM_POWER), list(z))
|
||||
return ..()
|
||||
|
||||
/obj/machinery/computer/station_alert/Destroy()
|
||||
GLOB.alert_consoles -= src
|
||||
QDEL_NULL(listener)
|
||||
return ..()
|
||||
|
||||
/obj/machinery/computer/station_alert/ui_interact(mob/user, datum/tgui/ui)
|
||||
@@ -26,69 +27,19 @@
|
||||
var/list/data = list()
|
||||
|
||||
data["alarms"] = list()
|
||||
for(var/class in alarms)
|
||||
data["alarms"][class] = list()
|
||||
for(var/area in alarms[class])
|
||||
data["alarms"][class] += area
|
||||
var/list/alarms = listener.alarms
|
||||
for(var/alarm_type in alarms)
|
||||
data["alarms"][alarm_type] = list()
|
||||
for(var/area_name in alarms[alarm_type])
|
||||
data["alarms"][alarm_type] += area_name
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/computer/station_alert/proc/triggerAlarm(class, area/home, cameras, obj/source)
|
||||
if(source.z != z)
|
||||
return
|
||||
if(stat & (BROKEN))
|
||||
return
|
||||
|
||||
var/list/our_sort = alarms[class]
|
||||
for(var/areaname in our_sort)
|
||||
if (areaname == home.name)
|
||||
var/list/alarm = our_sort[areaname]
|
||||
var/list/sources = alarm[3]
|
||||
if (!(source in sources))
|
||||
sources += source
|
||||
return TRUE
|
||||
|
||||
var/obj/machinery/camera/cam = null
|
||||
var/list/our_cams = null
|
||||
if(cameras && islist(cameras))
|
||||
our_cams = cameras
|
||||
if (our_cams.len == 1)
|
||||
cam = our_cams[1]
|
||||
else if(cameras && istype(cameras, /obj/machinery/camera))
|
||||
cam = cameras
|
||||
our_sort[home.name] = list(home, (cam ? cam : cameras), list(source))
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/computer/station_alert/proc/freeCamera(area/home, obj/machinery/camera/cam)
|
||||
for(var/class in alarms)
|
||||
var/our_area = alarms[class][home.name]
|
||||
if(!our_area)
|
||||
continue
|
||||
var/cams = our_area[2] //Get the cameras
|
||||
if(!cams)
|
||||
continue
|
||||
if(islist(cams))
|
||||
cams -= cam
|
||||
if(length(cams) == 1)
|
||||
our_area[2] = cams[1]
|
||||
else
|
||||
our_area[2] = null
|
||||
|
||||
/obj/machinery/computer/station_alert/proc/cancelAlarm(class, area/A, obj/origin)
|
||||
if(stat & (BROKEN))
|
||||
return
|
||||
var/list/L = alarms[class]
|
||||
var/cleared = 0
|
||||
for (var/I in L)
|
||||
if (I == A.name)
|
||||
var/list/alarm = L[I]
|
||||
var/list/srcs = alarm[3]
|
||||
if (origin in srcs)
|
||||
srcs -= origin
|
||||
if (srcs.len == 0)
|
||||
cleared = 1
|
||||
L -= I
|
||||
return !cleared
|
||||
/obj/machinery/computer/station_alert/on_machine_stat_update(stat)
|
||||
if(stat & BROKEN)
|
||||
listener.prevent_alarm_changes()
|
||||
else
|
||||
listener.allow_alarm_changes()
|
||||
|
||||
/obj/machinery/computer/station_alert/update_overlays()
|
||||
. = ..()
|
||||
@@ -98,12 +49,7 @@
|
||||
. |= "[icon_keyboard]_off"
|
||||
return
|
||||
. |= icon_keyboard
|
||||
var/active_alarms = FALSE
|
||||
for(var/cat in alarms)
|
||||
if(length(alarms[cat]))
|
||||
active_alarms = TRUE
|
||||
break
|
||||
if(active_alarms)
|
||||
if(length(listener.alarms))
|
||||
overlay_state = "alert:2"
|
||||
else
|
||||
overlay_state = "alert:0"
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
var/start_showpiece_type = null //add type for items on display
|
||||
var/list/start_showpieces = list() //Takes sublists in the form of list("type" = /obj/item/bikehorn, "trophy_message" = "henk")
|
||||
var/trophy_message = ""
|
||||
///Represents a signel source of screaming when broken
|
||||
var/datum/alarm_handler/alarm_manager
|
||||
|
||||
/obj/structure/displaycase/Initialize(mapload)
|
||||
. = ..()
|
||||
@@ -31,20 +33,20 @@
|
||||
if(start_showpiece_type)
|
||||
showpiece = new start_showpiece_type (src)
|
||||
update_icon()
|
||||
alarm_manager = new(src)
|
||||
|
||||
/obj/structure/displaycase/Destroy()
|
||||
if(electronics)
|
||||
QDEL_NULL(electronics)
|
||||
if(showpiece)
|
||||
QDEL_NULL(showpiece)
|
||||
QDEL_NULL(electronics)
|
||||
QDEL_NULL(showpiece)
|
||||
QDEL_NULL(alarm_manager)
|
||||
return ..()
|
||||
|
||||
/obj/structure/displaycase/examine(mob/user)
|
||||
. = ..()
|
||||
if(alert)
|
||||
. += "<span class='notice'>Hooked up with an anti-theft system.</span>"
|
||||
. += span_notice("Hooked up with an anti-theft system.")
|
||||
if(showpiece)
|
||||
. += "<span class='notice'>There's [showpiece] inside.</span>"
|
||||
. += span_notice("There's [showpiece] inside.")
|
||||
if(trophy_message)
|
||||
. += "The plaque reads:"
|
||||
. += trophy_message
|
||||
@@ -79,12 +81,17 @@
|
||||
update_icon()
|
||||
trigger_alarm()
|
||||
|
||||
///Anti-theft alarm triggered when broken.
|
||||
/obj/structure/displaycase/proc/trigger_alarm()
|
||||
//Activate Anti-theft
|
||||
if(alert)
|
||||
var/area/alarmed = get_base_area(src)
|
||||
alarmed.burglaralert(src)
|
||||
playsound(src, 'sound/effects/alert.ogg', 50, 1)
|
||||
if(!alert)
|
||||
return
|
||||
var/area/alarmed = get_area(src)
|
||||
alarmed.burglaralert(src)
|
||||
|
||||
alarm_manager.send_alarm(ALARM_BURGLAR)
|
||||
addtimer(CALLBACK(alarm_manager, /datum/alarm_handler/proc/clear_alarm, ALARM_BURGLAR), 1 MINUTES)
|
||||
|
||||
playsound(src, 'sound/effects/alert.ogg', 50, TRUE)
|
||||
|
||||
/obj/structure/displaycase/update_icon_state()
|
||||
var/icon/I
|
||||
@@ -104,46 +111,46 @@
|
||||
/obj/structure/displaycase/attackby(obj/item/W, mob/user, params)
|
||||
if(W.GetID() && !broken && openable)
|
||||
if(allowed(user))
|
||||
to_chat(user, "<span class='notice'>You [open ? "close":"open"] [src].</span>")
|
||||
to_chat(user, span_notice("You [open ? "close":"open"] [src]."))
|
||||
toggle_lock(user)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
to_chat(user, span_alert("Access denied."))
|
||||
else if(W.tool_behaviour == TOOL_WELDER && user.a_intent == INTENT_HELP && !broken)
|
||||
if(obj_integrity < max_integrity)
|
||||
if(!W.tool_start_check(user, amount=5))
|
||||
return
|
||||
|
||||
to_chat(user, "<span class='notice'>You begin repairing [src].</span>")
|
||||
to_chat(user, span_notice("You begin repairing [src]."))
|
||||
if(W.use_tool(src, user, 40, amount=5, volume=50))
|
||||
obj_integrity = max_integrity
|
||||
update_icon()
|
||||
to_chat(user, "<span class='notice'>You repair [src].</span>")
|
||||
to_chat(user, span_notice("You repair [src]."))
|
||||
else
|
||||
to_chat(user, "<span class='warning'>[src] is already in good condition!</span>")
|
||||
to_chat(user, span_warning("[src] is already in good condition!"))
|
||||
return
|
||||
else if(!alert && W.tool_behaviour == TOOL_CROWBAR && openable) //Only applies to the lab cage and player made display cases
|
||||
if(broken)
|
||||
if(showpiece)
|
||||
to_chat(user, "<span class='notice'>Remove the displayed object first.</span>")
|
||||
to_chat(user, span_notice("Remove the displayed object first."))
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You remove the destroyed case</span>")
|
||||
to_chat(user, span_notice("You remove the destroyed case"))
|
||||
qdel(src)
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You start to [open ? "close":"open"] [src].</span>")
|
||||
to_chat(user, span_notice("You start to [open ? "close":"open"] [src]."))
|
||||
if(W.use_tool(src, user, 20))
|
||||
to_chat(user, "<span class='notice'>You [open ? "close":"open"] [src].</span>")
|
||||
to_chat(user, span_notice("You [open ? "close":"open"] [src]."))
|
||||
toggle_lock(user)
|
||||
else if(open && !showpiece)
|
||||
if(user.transferItemToLoc(W, src))
|
||||
showpiece = W
|
||||
to_chat(user, "<span class='notice'>You put [W] on display</span>")
|
||||
to_chat(user, span_notice("You put [W] on display"))
|
||||
update_icon()
|
||||
else if(istype(W, /obj/item/stack/sheet/glass) && broken)
|
||||
var/obj/item/stack/sheet/glass/G = W
|
||||
if(G.get_amount() < 2)
|
||||
to_chat(user, "<span class='warning'>You need two glass sheets to fix the case!</span>")
|
||||
to_chat(user, span_warning("You need two glass sheets to fix the case!"))
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You start fixing [src]...</span>")
|
||||
to_chat(user, span_notice("You start fixing [src]..."))
|
||||
if(do_after(user, 20, target = src))
|
||||
G.use(2)
|
||||
broken = 0
|
||||
@@ -161,7 +168,7 @@
|
||||
|
||||
/obj/structure/displaycase/on_attack_hand(mob/user, act_intent = user.a_intent, unarmed_attack_flags)
|
||||
if (showpiece && (broken || open))
|
||||
to_chat(user, "<span class='notice'>You deactivate the hover field built into the case.</span>")
|
||||
to_chat(user, span_notice("You deactivate the hover field built into the case."))
|
||||
log_combat(user, src, "deactivates the hover field of")
|
||||
dump()
|
||||
src.add_fingerprint(user)
|
||||
@@ -171,7 +178,7 @@
|
||||
//prevents remote "kicks" with TK
|
||||
if (!Adjacent(user))
|
||||
return
|
||||
user.visible_message("<span class='danger'>[user] kicks the display case.</span>", null, null, COMBAT_MESSAGE_RANGE)
|
||||
user.visible_message(span_danger("[user] kicks the display case."), null, null, COMBAT_MESSAGE_RANGE)
|
||||
log_combat(user, src, "kicks")
|
||||
user.do_attack_animation(src, ATTACK_EFFECT_KICK)
|
||||
take_damage(2)
|
||||
@@ -188,7 +195,7 @@
|
||||
|
||||
/obj/structure/displaycase_chassis/attackby(obj/item/I, mob/user, params)
|
||||
if(I.tool_behaviour == TOOL_WRENCH) //The player can only deconstruct the wooden frame
|
||||
to_chat(user, "<span class='notice'>You start disassembling [src]...</span>")
|
||||
to_chat(user, span_notice("You start disassembling [src]..."))
|
||||
I.play_tool_sound(src)
|
||||
if(I.use_tool(src, user, 30))
|
||||
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1)
|
||||
@@ -196,18 +203,18 @@
|
||||
qdel(src)
|
||||
|
||||
else if(istype(I, /obj/item/electronics/airlock))
|
||||
to_chat(user, "<span class='notice'>You start installing the electronics into [src]...</span>")
|
||||
to_chat(user, span_notice("You start installing the electronics into [src]..."))
|
||||
I.play_tool_sound(src)
|
||||
if(do_after(user, 30, target = src) && user.transferItemToLoc(I,src))
|
||||
electronics = I
|
||||
to_chat(user, "<span class='notice'>You install the airlock electronics.</span>")
|
||||
to_chat(user, span_notice("You install the airlock electronics."))
|
||||
|
||||
else if(istype(I, /obj/item/stack/sheet/glass))
|
||||
var/obj/item/stack/sheet/glass/G = I
|
||||
if(G.get_amount() < 10)
|
||||
to_chat(user, "<span class='warning'>You need ten glass sheets to do this!</span>")
|
||||
to_chat(user, span_warning("You need ten glass sheets to do this!"))
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You start adding [G] to [src]...</span>")
|
||||
to_chat(user, span_notice("You start adding [G] to [src]..."))
|
||||
if(do_after(user, 20, target = src))
|
||||
G.use(10)
|
||||
var/obj/structure/displaycase/display = new(src.loc)
|
||||
@@ -272,11 +279,11 @@
|
||||
is_locked = !is_locked
|
||||
to_chat(user, "You [!is_locked ? "un" : ""]lock the case.")
|
||||
else
|
||||
to_chat(user, "<span class='danger'>The lock is stuck shut!</span>")
|
||||
to_chat(user, span_danger("The lock is stuck shut!"))
|
||||
return
|
||||
|
||||
if(is_locked)
|
||||
to_chat(user, "<span class='danger'>The case is shut tight with an old fashioned physical lock. Maybe you should ask the curator for the key?</span>")
|
||||
to_chat(user, span_danger("The case is shut tight with an old fashioned physical lock. Maybe you should ask the curator for the key?"))
|
||||
return
|
||||
|
||||
if(!added_roundstart)
|
||||
@@ -284,12 +291,12 @@
|
||||
return
|
||||
|
||||
if(is_type_in_typecache(W, GLOB.blacklisted_cargo_types))
|
||||
to_chat(user, "<span class='danger'>The case rejects the [W].</span>")
|
||||
to_chat(user, span_danger("The case rejects the [W]."))
|
||||
return
|
||||
|
||||
for(var/a in W.GetAllContents())
|
||||
if(is_type_in_typecache(a, GLOB.blacklisted_cargo_types))
|
||||
to_chat(user, "<span class='danger'>The case rejects the [W].</span>")
|
||||
to_chat(user, span_danger("The case rejects the [W]."))
|
||||
return
|
||||
|
||||
if(user.transferItemToLoc(W, src))
|
||||
@@ -319,14 +326,14 @@
|
||||
return TRUE
|
||||
|
||||
else
|
||||
to_chat(user, "<span class='warning'>\The [W] is stuck to your hand, you can't put it in the [src.name]!</span>")
|
||||
to_chat(user, span_warning("\The [W] is stuck to your hand, you can't put it in the [src.name]!"))
|
||||
|
||||
return
|
||||
|
||||
/obj/structure/displaycase/trophy/dump()
|
||||
if (showpiece)
|
||||
if(added_roundstart)
|
||||
visible_message("<span class='danger'>The [showpiece] crumbles to dust!</span>")
|
||||
visible_message(span_danger("The [showpiece] crumbles to dust!"))
|
||||
new /obj/effect/decal/cleanable/ash(loc)
|
||||
QDEL_NULL(showpiece)
|
||||
else
|
||||
@@ -411,32 +418,32 @@
|
||||
switch(action)
|
||||
if("Buy")
|
||||
if(!showpiece)
|
||||
to_chat(usr, "<span class='notice'>There's nothing for sale.</span>")
|
||||
to_chat(usr, span_notice("There's nothing for sale."))
|
||||
return TRUE
|
||||
if(broken)
|
||||
to_chat(usr, "<span class='notice'>[src] appears to be broken.</span>")
|
||||
to_chat(usr, span_notice("[src] appears to be broken."))
|
||||
return TRUE
|
||||
if(!payments_acc)
|
||||
to_chat(usr, "<span class='notice'>[src] hasn't been registered yet.</span>")
|
||||
to_chat(usr, span_notice("[src] hasn't been registered yet."))
|
||||
return TRUE
|
||||
if(!usr.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
|
||||
return TRUE
|
||||
if(!potential_acc)
|
||||
to_chat(usr, "<span class='notice'>No ID card detected.</span>")
|
||||
to_chat(usr, span_notice("No ID card detected."))
|
||||
return
|
||||
var/datum/bank_account/account = potential_acc.registered_account
|
||||
if(!account)
|
||||
to_chat(usr, "<span class='notice'>[potential_acc] has no account registered!</span>")
|
||||
to_chat(usr, span_notice("[potential_acc] has no account registered!"))
|
||||
return
|
||||
if(!account.has_money(sale_price))
|
||||
to_chat(usr, "<span class='notice'>You do not possess the funds to purchase this.</span>")
|
||||
to_chat(usr, span_notice("You do not possess the funds to purchase this."))
|
||||
return TRUE
|
||||
else
|
||||
account.adjust_money(-sale_price)
|
||||
if(payments_acc)
|
||||
payments_acc.adjust_money(sale_price)
|
||||
usr.put_in_hands(showpiece)
|
||||
to_chat(usr, "<span class='notice'>You purchase [showpiece] for [sale_price] credits.</span>")
|
||||
to_chat(usr, span_notice("You purchase [showpiece] for [sale_price] credits."))
|
||||
// playsound(src, 'sound/effects/cashregister.ogg', 40, TRUE)
|
||||
icon = 'icons/obj/stationobjs.dmi'
|
||||
flick("laserbox_vend", src)
|
||||
@@ -446,7 +453,7 @@
|
||||
return TRUE
|
||||
if("Open")
|
||||
if(!payments_acc)
|
||||
to_chat(usr, "<span class='notice'>[src] hasn't been registered yet.</span>")
|
||||
to_chat(usr, span_notice("[src] hasn't been registered yet."))
|
||||
return TRUE
|
||||
if(!potential_acc || !potential_acc.registered_account)
|
||||
return
|
||||
@@ -472,14 +479,14 @@
|
||||
|
||||
var/new_price_input = input(usr,"Set the sale price for this vend-a-tray.","new price",0) as num|null
|
||||
if(isnull(new_price_input) || (payments_acc != potential_acc.registered_account))
|
||||
to_chat(usr, "<span class='warning'>[src] rejects your new price.</span>")
|
||||
to_chat(usr, span_warning("[src] rejects your new price."))
|
||||
return
|
||||
if(!usr.canUseTopic(src, BE_CLOSE, FALSE, NO_TK) )
|
||||
to_chat(usr, "<span class='warning'>You need to get closer!</span>")
|
||||
to_chat(usr, span_warning("You need to get closer!"))
|
||||
return
|
||||
new_price_input = clamp(round(new_price_input, 1), 10, 1000)
|
||||
sale_price = new_price_input
|
||||
to_chat(usr, "<span class='notice'>The cost is now set to [sale_price].</span>")
|
||||
to_chat(usr, span_notice("The cost is now set to [sale_price]."))
|
||||
SStgui.update_uis(src)
|
||||
return TRUE
|
||||
. = TRUE
|
||||
@@ -488,7 +495,7 @@
|
||||
//Card Registration
|
||||
var/obj/item/card/id/potential_acc = I
|
||||
if(!potential_acc.registered_account)
|
||||
to_chat(user, "<span class='warning'>This ID card has no account registered!</span>")
|
||||
to_chat(user, span_warning("This ID card has no account registered!"))
|
||||
return
|
||||
if(payments_acc == potential_acc.registered_account)
|
||||
playsound(src, 'sound/machines/click.ogg', 20, TRUE)
|
||||
@@ -503,7 +510,7 @@
|
||||
/obj/structure/displaycase/forsale/multitool_act(mob/living/user, obj/item/I)
|
||||
. = ..()
|
||||
if(obj_integrity <= (integrity_failure * max_integrity))
|
||||
to_chat(user, "<span class='notice'>You start recalibrating [src]'s hover field...</span>")
|
||||
to_chat(user, span_notice("You start recalibrating [src]'s hover field..."))
|
||||
if(do_after(user, 20, target = src))
|
||||
broken = 0
|
||||
obj_integrity = max_integrity
|
||||
@@ -514,34 +521,34 @@
|
||||
. = ..()
|
||||
if(open && user.a_intent == INTENT_HELP )
|
||||
if(anchored)
|
||||
to_chat(user, "<span class='notice'>You start unsecuring [src]...</span>")
|
||||
to_chat(user, span_notice("You start unsecuring [src]..."))
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You start securing [src]...</span>")
|
||||
to_chat(user, span_notice("You start securing [src]..."))
|
||||
if(I.use_tool(src, user, 16, volume=50))
|
||||
if(QDELETED(I))
|
||||
return
|
||||
if(anchored)
|
||||
to_chat(user, "<span class='notice'>You unsecure [src].</span>")
|
||||
to_chat(user, span_notice("You unsecure [src]."))
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You secure [src].</span>")
|
||||
to_chat(user, span_notice("You secure [src]."))
|
||||
anchored = !anchored
|
||||
return
|
||||
else if(!open && user.a_intent == INTENT_HELP)
|
||||
to_chat(user, "<span class='notice'>[src] must be open to move it.</span>")
|
||||
to_chat(user, span_notice("[src] must be open to move it."))
|
||||
return
|
||||
|
||||
/obj/structure/displaycase/forsale/emag_act(mob/user)
|
||||
. = ..()
|
||||
payments_acc = null
|
||||
req_access = list()
|
||||
to_chat(user, "<span class='warning'>[src]'s card reader fizzles and smokes, and the account owner is reset.</span>")
|
||||
to_chat(user, span_warning("[src]'s card reader fizzles and smokes, and the account owner is reset."))
|
||||
|
||||
/obj/structure/displaycase/forsale/examine(mob/user)
|
||||
. = ..()
|
||||
if(showpiece && !open)
|
||||
. += "<span class='notice'>[showpiece] is for sale for [sale_price] credits.</span>"
|
||||
. += span_notice("[showpiece] is for sale for [sale_price] credits.")
|
||||
if(broken)
|
||||
. += "<span class='notice'>[src] is sparking and the hover field generator seems to be overloaded. Use a multitool to fix it.</span>"
|
||||
. += span_notice("[src] is sparking and the hover field generator seems to be overloaded. Use a multitool to fix it.")
|
||||
|
||||
/obj/structure/displaycase/forsale/obj_break(damage_flag)
|
||||
if(!broken && !(flags_1 & NODECONSTRUCT_1))
|
||||
|
||||
Reference in New Issue
Block a user