mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 16:47:13 +01:00
Merge pull request #37 from Skyrat-SS13/upstream-merge-52275
[MIRROR] Fixes display cases going invisible when you put shit into them
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/obj/structure/displaycase
|
||||
name = "display case"
|
||||
icon = 'icons/obj/stationobjs.dmi'
|
||||
icon_state = "glassbox0"
|
||||
icon_state = "glassbox"
|
||||
desc = "A display case for prized possessions."
|
||||
density = TRUE
|
||||
anchored = TRUE
|
||||
@@ -14,6 +14,7 @@
|
||||
var/alert = TRUE
|
||||
var/open = FALSE
|
||||
var/openable = TRUE
|
||||
var/custom_glass_overlay = FALSE ///If we have a custom glass overlay to use.
|
||||
var/obj/item/electronics/airlock/electronics
|
||||
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")
|
||||
@@ -32,11 +33,22 @@
|
||||
showpiece = new start_showpiece_type (src)
|
||||
update_icon()
|
||||
|
||||
/obj/structure/displaycase/vv_edit_var(vname, vval)
|
||||
. = ..()
|
||||
if(vname in list(NAMEOF(src, open), NAMEOF(src, showpiece), NAMEOF(src, custom_glass_overlay)))
|
||||
update_icon()
|
||||
|
||||
/obj/structure/displaycase/handle_atom_del(atom/A)
|
||||
if(A == electronics)
|
||||
electronics = null
|
||||
if(A == showpiece)
|
||||
showpiece = null
|
||||
update_icon()
|
||||
return ..()
|
||||
|
||||
/obj/structure/displaycase/Destroy()
|
||||
if(electronics)
|
||||
QDEL_NULL(electronics)
|
||||
if(showpiece)
|
||||
QDEL_NULL(showpiece)
|
||||
QDEL_NULL(electronics)
|
||||
QDEL_NULL(showpiece)
|
||||
return ..()
|
||||
|
||||
/obj/structure/displaycase/examine(mob/user)
|
||||
@@ -44,61 +56,62 @@
|
||||
if(alert)
|
||||
. += "<span class='notice'>Hooked up with an anti-theft system.</span>"
|
||||
if(showpiece)
|
||||
. += "<span class='notice'>There's [showpiece] inside.</span>"
|
||||
. += "<span class='notice'>There's \a [showpiece] inside.</span>"
|
||||
if(trophy_message)
|
||||
. += "The plaque reads:\n [trophy_message]"
|
||||
|
||||
|
||||
/obj/structure/displaycase/proc/dump()
|
||||
if (showpiece)
|
||||
showpiece.forceMove(loc)
|
||||
showpiece = null
|
||||
if(QDELETED(showpiece))
|
||||
return
|
||||
showpiece.forceMove(drop_location())
|
||||
showpiece = null
|
||||
update_icon()
|
||||
|
||||
/obj/structure/displaycase/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
|
||||
switch(damage_type)
|
||||
if(BRUTE)
|
||||
playsound(src.loc, 'sound/effects/glasshit.ogg', 75, TRUE)
|
||||
playsound(src, 'sound/effects/glasshit.ogg', 75, TRUE)
|
||||
if(BURN)
|
||||
playsound(src.loc, 'sound/items/welder.ogg', 100, TRUE)
|
||||
playsound(src, 'sound/items/welder.ogg', 100, TRUE)
|
||||
|
||||
/obj/structure/displaycase/deconstruct(disassembled = TRUE)
|
||||
if(!(flags_1 & NODECONSTRUCT_1))
|
||||
dump()
|
||||
if(!disassembled)
|
||||
new /obj/item/shard( src.loc )
|
||||
new /obj/item/shard(drop_location())
|
||||
trigger_alarm()
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/displaycase/obj_break(damage_flag)
|
||||
if(!broken && !(flags_1 & NODECONSTRUCT_1))
|
||||
density = FALSE
|
||||
broken = 1
|
||||
new /obj/item/shard( src.loc )
|
||||
broken = TRUE
|
||||
new /obj/item/shard(drop_location())
|
||||
playsound(src, "shatter", 70, TRUE)
|
||||
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_area(src)
|
||||
alarmed.burglaralert(src)
|
||||
playsound(src, 'sound/effects/alert.ogg', 50, TRUE)
|
||||
if(!alert)
|
||||
return
|
||||
var/area/alarmed = get_area(src)
|
||||
alarmed.burglaralert(src)
|
||||
playsound(src, 'sound/effects/alert.ogg', 50, TRUE)
|
||||
|
||||
/obj/structure/displaycase/update_icon()
|
||||
var/icon/I
|
||||
if(open)
|
||||
I = icon('icons/obj/stationobjs.dmi',"glassbox_open")
|
||||
else
|
||||
I = icon('icons/obj/stationobjs.dmi',"glassbox0")
|
||||
if(broken)
|
||||
I = icon('icons/obj/stationobjs.dmi',"glassboxb0")
|
||||
/obj/structure/displaycase/update_overlays()
|
||||
. = ..()
|
||||
if(showpiece)
|
||||
var/icon/S = getFlatIcon(showpiece)
|
||||
S.Scale(17,17)
|
||||
I.Blend(S,ICON_UNDERLAY,8,8)
|
||||
src.icon = I
|
||||
return
|
||||
var/mutable_appearance/showpiece_overlay = mutable_appearance(showpiece.icon, showpiece.icon_state)
|
||||
showpiece_overlay.copy_overlays(showpiece)
|
||||
showpiece_overlay.transform *= 0.6
|
||||
. += showpiece_overlay
|
||||
if(custom_glass_overlay)
|
||||
return
|
||||
if(broken)
|
||||
. += "[initial(icon_state)]_broken"
|
||||
else if(!open)
|
||||
. += "[initial(icon_state)]_closed"
|
||||
|
||||
/obj/structure/displaycase/attackby(obj/item/W, mob/user, params)
|
||||
if(W.GetID() && !broken && openable)
|
||||
@@ -148,7 +161,7 @@
|
||||
to_chat(user, "<span class='notice'>You start fixing [src]...</span>")
|
||||
if(do_after(user, 20, target = src))
|
||||
G.use(2)
|
||||
broken = 0
|
||||
broken = FALSE
|
||||
obj_integrity = max_integrity
|
||||
update_icon()
|
||||
else
|
||||
@@ -170,8 +183,7 @@
|
||||
to_chat(user, "<span class='notice'>You deactivate the hover field built into the case.</span>")
|
||||
log_combat(user, src, "deactivates the hover field of")
|
||||
dump()
|
||||
src.add_fingerprint(user)
|
||||
update_icon()
|
||||
add_fingerprint(user)
|
||||
return
|
||||
else
|
||||
//prevents remote "kicks" with TK
|
||||
@@ -347,7 +359,7 @@
|
||||
new /obj/effect/decal/cleanable/ash(loc)
|
||||
QDEL_NULL(showpiece)
|
||||
else
|
||||
..()
|
||||
return ..()
|
||||
|
||||
/obj/item/key/displaycase
|
||||
name = "display case key"
|
||||
@@ -365,8 +377,8 @@
|
||||
|
||||
/obj/structure/displaycase/forsale
|
||||
name = "vend-a-tray"
|
||||
icon = 'icons/obj/stationobjs.dmi'
|
||||
icon_state = "laserbox0"
|
||||
icon_state = "laserbox"
|
||||
custom_glass_overlay = TRUE
|
||||
desc = "A display case with an ID-card swiper. Use your ID to purchase the contents."
|
||||
density = FALSE
|
||||
max_integrity = 100
|
||||
@@ -381,22 +393,13 @@
|
||||
///We're using the same trick as paper does in order to cache the image, and only load the UI when messed with.
|
||||
var/list/viewing_ui = list()
|
||||
|
||||
/obj/structure/displaycase/forsale/update_icon() //remind me to fix my shitcode later
|
||||
var/icon/I
|
||||
if(open)
|
||||
I = icon('icons/obj/stationobjs.dmi',"laserboxb0")
|
||||
else
|
||||
I = icon('icons/obj/stationobjs.dmi',"laserbox0")
|
||||
if(!showpiece && !open)
|
||||
I = icon('icons/obj/stationobjs.dmi',"laserbox_open")
|
||||
if(broken)
|
||||
I = icon('icons/obj/stationobjs.dmi',"laserbox_broken")
|
||||
if(showpiece)
|
||||
var/icon/S = getFlatIcon(showpiece)
|
||||
S.Scale(17,17)
|
||||
I.Blend(S,ICON_UNDERLAY,8,12)
|
||||
src.icon = I
|
||||
return
|
||||
/obj/structure/displaycase/forsale/update_icon_state()
|
||||
icon_state = "[initial(icon_state)][broken ? "_broken" : (open ? "_open" : (!showpiece ? "_empty" : null))]"
|
||||
|
||||
/obj/structure/displaycase/forsale/update_overlays()
|
||||
. = ..()
|
||||
if(!broken && !open)
|
||||
. += "[initial(icon_state)]_overlay"
|
||||
|
||||
/obj/structure/displaycase/forsale/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
@@ -455,8 +458,7 @@
|
||||
usr.put_in_hands(showpiece)
|
||||
to_chat(usr, "<span class='notice'>You purchase [showpiece] for [sale_price] credits.</span>")
|
||||
playsound(src, 'sound/effects/cashregister.ogg', 40, TRUE)
|
||||
icon = 'icons/obj/stationobjs.dmi'
|
||||
flick("laserbox_vend", src)
|
||||
flick("[initial(icon_state)]_vend", src)
|
||||
showpiece = null
|
||||
update_icon()
|
||||
SStgui.update_uis(src)
|
||||
@@ -522,7 +524,7 @@
|
||||
if(obj_integrity <= (integrity_failure * max_integrity))
|
||||
to_chat(user, "<span class='notice'>You start recalibrating [src]'s hover field...</span>")
|
||||
if(do_after(user, 20, target = src))
|
||||
broken = 0
|
||||
broken = FALSE
|
||||
obj_integrity = max_integrity
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 81 KiB |
Reference in New Issue
Block a user