Files
Bubberstation/code/game/objects/items/holosign_creator.dm
GhomandGitHub 6eb2d1674a Implementing materials checks for techweb designs. (#96257)
## About The Pull Request
In similar fashion to what was done with crafting recipes last year,
this year it's time for techweb designs and printed items to be audited.
This is mostly just about consistency, we've a lot of items that can be
printed by protolathes, autolathes, circuit printers and techfab etc.
However they almost all (except most stacks, mainly) have custom
materials that do not match in one way or another with the materials
used by the design, which is what this PR is for.

"But items printed from lathes etc. already get the mats used to make
them." Yes, they do, however that isn't the case for items of the same
type that were spawned in some other way (cargo shuttle, space/maints
loot, mapped, admins), this create a subtle discrepancy. It isn't a huge
deal (in spite of the size of this PR, ton of designs), but given that I
have done something similar with crafting recipes before, I may as well
give it a second arc of some sort and bring things to completion. And
fix a few possible oversights.

TL;DR consistency and stuff

## Why It's Good For The Game
Consistency, unit test checks to make it harder not to be consistent in
the future. Still has a few TODOs like:

- [x] Fixed newly printed, fully charged RCDs costing less than the RCD
cartridges required to fully charge one. EDIT: I had to tweak the newly
added RDD as well because it suffered from the same fundamental issue.
- [x] Fixed plates being made of iron and yet shattering like ceramic
ones. A new subtype for metallic ones has been made.

## Changelog

🆑
refactor: Refactored a few things with techweb designs (the ones for
autolathes, protolathes, circuit printers, mechfabs etc.) to make sure
that the materials of items that can be made from these designs more
closely match the materials used to make them.
fix: Lizard fries no longer need a plate to be made, like all other
treats that used to require plates in a distant past.
balance: Tweaked the materials cost of RCD, RDD and RCD cartridges.
image: Oven trays now have a more metallic hue.
balance: Plates printed printed from lathes won't shatter like ceramic
ones, in virtue of them being made out of iron instead.
/🆑
2026-07-06 00:13:02 -07:00

248 lines
9.7 KiB
Plaintext

/obj/item/holosign_creator
name = "holographic sign projector"
desc = "A handy-dandy holographic projector that displays a janitorial sign."
icon = 'icons/obj/devices/tool.dmi'
icon_state = "signmaker"
inhand_icon_state = "electronic"
worn_icon_state = "electronic"
lefthand_file = 'icons/mob/inhands/items/devices_lefthand.dmi'
righthand_file = 'icons/mob/inhands/items/devices_righthand.dmi'
force = 0
w_class = WEIGHT_CLASS_SMALL
throwforce = 0
throw_speed = 3
throw_range = 7
item_flags = NOBLUDGEON
sound_vary = TRUE
pickup_sound = SFX_GENERIC_DEVICE_PICKUP
drop_sound = SFX_GENERIC_DEVICE_DROP
custom_materials = list(/datum/material/iron = SHEET_MATERIAL_AMOUNT, /datum/material/glass = HALF_SHEET_MATERIAL_AMOUNT)
var/list/signs
var/max_signs = 10
//time to create a holosign in deciseconds.
var/creation_time = 0
//holosign image that is projected
var/holosign_type = /obj/structure/holosign/wetsign
var/holocreator_busy = FALSE //to prevent placing multiple holo barriers at once
/// List of special things we can project holofans under/through.
var/list/projectable_through = list(
/obj/machinery/door,
/obj/structure/mineral_door,
)
/obj/item/holosign_creator/Initialize(mapload)
. = ..()
AddElement(/datum/element/openspace_item_click_handler)
RegisterSignal(src, COMSIG_OBJ_PAINTED, TYPE_PROC_REF(/obj/item/holosign_creator, on_color_change))
/obj/item/holosign_creator/handle_openspace_click(turf/target, mob/user, list/modifiers)
interact_with_atom(target, user, modifiers)
/obj/item/holosign_creator/examine(mob/user)
. = ..()
if(!signs)
return
. += span_notice("It is currently maintaining <b>[signs.len]/[max_signs]</b> projections.")
/obj/item/holosign_creator/check_allowed_items(atom/target, not_inside, target_self)
if(HAS_TRAIT(target, TRAIT_COMBAT_MODE_SKIP_INTERACTION))
return FALSE
return ..()
/obj/item/holosign_creator/interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
if(!check_allowed_items(interacting_with, not_inside = TRUE))
return NONE
var/turf/target_turf = get_turf(interacting_with)
var/obj/structure/holosign/target_holosign = locate(holosign_type) in target_turf
if(target_holosign)
return ITEM_INTERACT_BLOCKING
if(target_turf.is_blocked_turf(TRUE, ignore_atoms = projectable_through, type_list = TRUE)) //can't put holograms on a tile that has dense stuff
return ITEM_INTERACT_BLOCKING
if(holocreator_busy)
balloon_alert(user, "busy making a hologram!")
return ITEM_INTERACT_BLOCKING
if(LAZYLEN(signs) >= max_signs)
balloon_alert(user, "max capacity!")
return ITEM_INTERACT_BLOCKING
playsound(src, 'sound/machines/click.ogg', 20, TRUE)
if(creation_time)
holocreator_busy = TRUE
if(!do_after(user, creation_time, target = interacting_with))
holocreator_busy = FALSE
return ITEM_INTERACT_BLOCKING
holocreator_busy = FALSE
if(LAZYLEN(signs) >= max_signs)
return ITEM_INTERACT_BLOCKING
if(target_turf.is_blocked_turf(TRUE, ignore_atoms = projectable_through, type_list = TRUE)) //don't try to sneak dense stuff on our tile during the wait.
return ITEM_INTERACT_BLOCKING
target_holosign = create_holosign(interacting_with, user)
return ITEM_INTERACT_SUCCESS
/obj/item/holosign_creator/attack(mob/living/carbon/human/M, mob/user)
return
/obj/item/holosign_creator/proc/create_holosign(atom/target, mob/user)
var/atom/new_holosign = new holosign_type(get_turf(target), src)
new_holosign.add_hiddenprint(user)
if(color)
new_holosign.color = color
return new_holosign
/obj/item/holosign_creator/attack_self(mob/user)
if(LAZYLEN(signs))
for(var/obj/structure/holosign/hologram as anything in signs)
qdel(hologram)
balloon_alert(user, "holograms cleared")
/obj/item/holosign_creator/Destroy()
. = ..()
if(LAZYLEN(signs))
for(var/obj/structure/holosign/hologram as anything in signs)
qdel(hologram)
/obj/item/holosign_creator/proc/on_color_change(obj/item/holosign_creator, mob/user, obj/item/toy/crayon/spraycan/spraycan, is_dark_color)
SIGNAL_HANDLER
if(!spraycan.actually_paints)
return
if(LAZYLEN(signs))
for(var/obj/structure/holosign/hologram as anything in signs)
hologram.color = color
/obj/item/holosign_creator/janibarrier
name = "custodial holobarrier projector"
desc = "A holographic projector that creates hard light wet floor barriers."
holosign_type = /obj/structure/holosign/barrier/wetsign
creation_time = 1 SECONDS
max_signs = 12
custom_materials = list(/datum/material/iron = SHEET_MATERIAL_AMOUNT, /datum/material/glass = HALF_SHEET_MATERIAL_AMOUNT, /datum/material/silver = HALF_SHEET_MATERIAL_AMOUNT)
/obj/item/holosign_creator/security
name = "security holobarrier projector"
desc = "A holographic projector that creates holographic security barriers. You can remotely open barriers with it."
icon_state = "signmaker_sec"
holosign_type = /obj/structure/holosign/barrier
creation_time = 2 SECONDS
max_signs = 6
custom_materials = list(/datum/material/iron = SHEET_MATERIAL_AMOUNT * 2.5, /datum/material/glass = HALF_SHEET_MATERIAL_AMOUNT, /datum/material/gold = HALF_SHEET_MATERIAL_AMOUNT, /datum/material/silver = HALF_SHEET_MATERIAL_AMOUNT)
/obj/item/holosign_creator/engineering
name = "engineering holobarrier projector"
desc = "A holographic projector that creates holographic engineering barriers. You can remotely open barriers with it."
icon_state = "signmaker_engi"
holosign_type = /obj/structure/holosign/barrier/engineering
creation_time = 1 SECONDS
max_signs = 12
custom_materials = list(/datum/material/iron = SHEET_MATERIAL_AMOUNT * 2.5, /datum/material/glass = HALF_SHEET_MATERIAL_AMOUNT, /datum/material/gold = HALF_SHEET_MATERIAL_AMOUNT, /datum/material/silver = HALF_SHEET_MATERIAL_AMOUNT)
/obj/item/holosign_creator/atmos
name = "ATMOS holofan projector"
desc = "A holographic projector that creates holographic barriers that prevent changes in atmosphere conditions."
icon_state = "signmaker_atmos"
holosign_type = /obj/structure/holosign/barrier/atmos
creation_time = 0
max_signs = 6
projectable_through = list(
/obj/machinery/door,
/obj/structure/mineral_door,
/obj/structure/window,
/obj/structure/grille,
)
custom_materials = list(/datum/material/iron = SHEET_MATERIAL_AMOUNT * 2.5, /datum/material/glass = HALF_SHEET_MATERIAL_AMOUNT, /datum/material/gold = HALF_SHEET_MATERIAL_AMOUNT, /datum/material/silver = HALF_SHEET_MATERIAL_AMOUNT)
/// Clearview holograms don't catch clicks and are more transparent
var/clearview = FALSE
/// Timer for auto-turning off clearview
var/clearview_timer
/obj/item/holosign_creator/atmos/Initialize(mapload)
. = ..()
register_context()
/obj/item/holosign_creator/atmos/interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
. = ..()
if(!(. & ITEM_INTERACT_SUCCESS))
return
var/obj/machinery/door/firedoor/firelock = locate() in get_turf(interacting_with)
firelock?.open()
/obj/item/holosign_creator/atmos/add_context(atom/source, list/context, obj/item/held_item, mob/user)
. = ..()
if(LAZYLEN(signs))
context[SCREENTIP_CONTEXT_RMB] = "[clearview ? "Turn off" : "Temporarily activate"] clearview"
return CONTEXTUAL_SCREENTIP_SET
/obj/item/holosign_creator/atmos/create_holosign(atom/target, mob/user)
var/obj/structure/holosign/barrier/atmos/new_holosign = new holosign_type(get_turf(target), src)
new_holosign.add_hiddenprint(user)
if(color)
new_holosign.color = color
if(clearview)
new_holosign.clearview_transparency()
return new_holosign
/obj/item/holosign_creator/atmos/attack_self_secondary(mob/user, modifiers)
if(clearview)
reset_hologram_transparency()
balloon_alert(user, "turned off clearview")
return
if(LAZYLEN(signs))
for(var/obj/structure/holosign/barrier/atmos/hologram as anything in signs)
hologram.clearview_transparency()
clearview = TRUE
balloon_alert(user, "turned on clearview")
clearview_timer = addtimer(CALLBACK(src, PROC_REF(reset_hologram_transparency)), 40 SECONDS, TIMER_STOPPABLE)
return ..()
/obj/item/holosign_creator/atmos/proc/reset_hologram_transparency()
if(LAZYLEN(signs))
for(var/obj/structure/holosign/barrier/atmos/hologram as anything in signs)
hologram.reset_transparency()
clearview = FALSE
deltimer(clearview_timer)
/obj/item/holosign_creator/medical
name = "\improper PENLITE barrier projector"
desc = "A holographic projector that creates PENLITE holobarriers. Useful during quarantines since they halt those with malicious diseases."
icon_state = "signmaker_med"
holosign_type = /obj/structure/holosign/barrier/medical
creation_time = 1 SECONDS
max_signs = 6
custom_materials = list(/datum/material/iron = HALF_SHEET_MATERIAL_AMOUNT, /datum/material/glass = HALF_SHEET_MATERIAL_AMOUNT, /datum/material/silver = SMALL_MATERIAL_AMOUNT)
/obj/item/holosign_creator/cyborg
name = "Energy Barrier Projector"
desc = "A holographic projector that creates fragile energy fields."
creation_time = 1.5 SECONDS
max_signs = 9
holosign_type = /obj/structure/holosign/barrier/cyborg
var/shock = FALSE
/obj/item/holosign_creator/cyborg/attack_self(mob/user)
if(iscyborg(user))
var/mob/living/silicon/robot/borg = user
if(shock)
to_chat(user, span_notice("You clear all active holograms, and reset your projector to normal."))
holosign_type = /obj/structure/holosign/barrier/cyborg
creation_time = 0.5 SECONDS
for(var/obj/structure/holosign/hologram as anything in signs)
qdel(hologram)
shock = FALSE
return
if(borg.emagged && !shock)
to_chat(user, span_warning("You clear all active holograms, and overload your energy projector!"))
holosign_type = /obj/structure/holosign/barrier/cyborg/hacked
creation_time = 3 SECONDS
for(var/obj/structure/holosign/hologram as anything in signs)
qdel(hologram)
shock = TRUE
return
for(var/obj/structure/holosign/hologram as anything in signs)
qdel(hologram)
balloon_alert(user, "holograms cleared")