listener update
This commit is contained in:
@@ -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