diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm index c5a48498b1e..8ddd2a76fb0 100644 --- a/code/game/objects/structures/displaycase.dm +++ b/code/game/objects/structures/displaycase.dm @@ -1,79 +1,116 @@ /obj/structure/displaycase name = "display case" - icon = 'icons/obj/stationobjs.dmi' - icon_state = "glassbox1" desc = "A display case for prized possessions. It taunts you to kick it." - density = 1 - anchored = 1 - unacidable = 1//Dissolving the case would also delete the gun. + icon = 'icons/obj/display_case.dmi' + icon_state = "glassbox" + density = TRUE + anchored = TRUE + unacidable = TRUE + req_access = list(access_captain) var/health = 30 - var/occupied = 1 - var/destroyed = 0 + var/obj/held_obj + var/open = FALSE + var/destroyed = FALSE + var/spawn_contained_type + +/obj/structure/displaycase/Initialize(mapload) + . = ..() + if(spawn_contained_type) + var/obj/O = new spawn_contained_type(src) + held_obj = O + update_icon() /obj/structure/displaycase/ex_act(severity) switch(severity) if (1) - new /obj/item/material/shard( src.loc ) - if (occupied) - new /obj/item/gun/energy/captain( src.loc ) - occupied = 0 - qdel(src) + do_destroy() if (2) - if (prob(50)) - src.health -= 15 - src.healthcheck() + if(prob(50)) + health -= 15 + health_check() if (3) - if (prob(50)) - src.health -= 5 - src.healthcheck() + if(prob(50)) + health -= 5 + health_check() /obj/structure/displaycase/bullet_act(var/obj/item/projectile/Proj) health -= Proj.get_structure_damage() ..() - src.healthcheck() - return + health_check() -/obj/structure/displaycase/proc/healthcheck() - if (src.health <= 0) - if (!( src.destroyed )) - src.density = 0 - src.destroyed = 1 - new /obj/item/material/shard( src.loc ) - playsound(src, /decl/sound_category/glass_break_sound, 70, 1) - update_icon() +/obj/structure/displaycase/proc/health_check() + if(health <= 0) + do_destroy() else - playsound(src.loc, 'sound/effects/glass_hit.ogg', 75, 1) - return + playsound(loc, 'sound/effects/glass_hit.ogg', 75, 1) + +/obj/structure/displaycase/proc/do_destroy() + if(!destroyed) + density = FALSE + destroyed = TRUE + new /obj/item/material/shard(loc) + playsound(src, /decl/sound_category/glass_break_sound, 70, 1) + update_icon() /obj/structure/displaycase/update_icon() - if(src.destroyed) - src.icon_state = "glassboxb[src.occupied]" + underlays = list() + if(destroyed) + icon_state = "glassbox-broken" + else if(open) + icon_state = "glassbox-open" else - src.icon_state = "glassbox[src.occupied]" - return + icon_state = "glassbox" + if(held_obj) + var/image/I = image(held_obj.icon, src, held_obj.icon_state) + underlays += I - -/obj/structure/displaycase/attackby(obj/item/W as obj, mob/user as mob) +/obj/structure/displaycase/attackby(obj/item/W, mob/user) user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) - src.health -= W.force - src.healthcheck() - ..() - return - -/obj/structure/displaycase/attack_hand(mob/user as mob) - if (src.destroyed && src.occupied) - new /obj/item/gun/energy/captain( src.loc ) - to_chat(user, "You deactivate the hover field built into the case.") - src.occupied = 0 - src.add_fingerprint(user) + if(istype(W, /obj/item/card/id)) + if(destroyed) + to_chat(user, SPAN_WARNING("\The [src] has been destroyed and cannot be unlocked.")) + return + var/obj/item/card/id/ID = W + if(check_access(ID)) + user.visible_message("[user] presses their ID against \the [src], [open ? "closing" : "opening"] it.", SPAN_NOTICE("You press your ID against \the [src], [open ? "closing" : "opening"] it.")) + open = !open + update_icon() + else + to_chat(user, SPAN_WARNING("Access denied.")) + else if(!held_obj && (destroyed || open)) + to_chat(user, SPAN_NOTICE("You set \the [W] down on \the [src].")) + user.drop_from_inventory(W, src) + held_obj = W update_icon() - return else - to_chat(usr, text("You kick the display case.")) - for(var/mob/O in oviewers()) - if ((O.client && !( O.blinded ))) - to_chat(O, "[usr] kicks the display case.") - src.health -= 2 - healthcheck() - return + if(destroyed) + to_chat(user, SPAN_WARNING("\The [src] has already been destroyed.")) + return + health -= W.force + health_check() + return ..() + +/obj/structure/displaycase/attack_hand(mob/user) + user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) + if(destroyed || open) + if(!held_obj) + to_chat(user, SPAN_WARNING("There is nothing held inside \the [src]!")) + else + user.put_in_hands(held_obj) + to_chat(user, SPAN_NOTICE("You take \the [held_obj] out of \the [src].")) + held_obj = null + update_icon() + else + if(user.a_intent != I_HURT) + if(held_obj) + to_chat(user, SPAN_NOTICE("You peer inside \the [src], noticing it has \a [held_obj] inside.")) + else + to_chat(user, SPAN_NOTICE("You peer inside \the [src], noticing it has nothing inside.")) + else + user.visible_message("[user] kicks \the [src].", SPAN_WARNING("You kick \the [src].")) + health -= 2 + health_check() + +/obj/structure/displaycase/captain_laser + spawn_contained_type = /obj/item/gun/energy/captain \ No newline at end of file diff --git a/html/changelogs/geeves-display_case_update.yml b/html/changelogs/geeves-display_case_update.yml new file mode 100644 index 00000000000..b4f38192155 --- /dev/null +++ b/html/changelogs/geeves-display_case_update.yml @@ -0,0 +1,7 @@ +author: Geeves + +delete-after: True + +changes: + - rscadd: "You can now open display cases with a captain level ID." + - rscadd: "You can now play any item in a display case." \ No newline at end of file diff --git a/icons/obj/display_case.dmi b/icons/obj/display_case.dmi new file mode 100644 index 00000000000..fe1181434dd Binary files /dev/null and b/icons/obj/display_case.dmi differ diff --git a/icons/obj/stationobjs.dmi b/icons/obj/stationobjs.dmi index d3e3972561c..4793ac16ef1 100644 Binary files a/icons/obj/stationobjs.dmi and b/icons/obj/stationobjs.dmi differ diff --git a/maps/aurora/aurora-4_mainlevel.dmm b/maps/aurora/aurora-4_mainlevel.dmm index 8be35a34f93..0bf306e0d4c 100644 --- a/maps/aurora/aurora-4_mainlevel.dmm +++ b/maps/aurora/aurora-4_mainlevel.dmm @@ -19379,7 +19379,7 @@ /turf/simulated/floor/carpet, /area/crew_quarters/captain) "aHh" = ( -/obj/structure/displaycase, +/obj/structure/displaycase/captain_laser, /turf/simulated/floor/carpet, /area/crew_quarters/captain) "aHi" = ( diff --git a/maps/exodus/exodus-1_station.dmm b/maps/exodus/exodus-1_station.dmm index d5bc1f4828c..6b31c666320 100644 --- a/maps/exodus/exodus-1_station.dmm +++ b/maps/exodus/exodus-1_station.dmm @@ -37411,10 +37411,10 @@ /turf/simulated/floor/plating, /area/turret_protected/ai_upload) "btV" = ( -/obj/structure/displaycase, /obj/machinery/light/small{ dir = 1 }, +/obj/structure/displaycase/captain_laser, /turf/simulated/floor/carpet, /area/crew_quarters/captain) "btW" = (