Files
Bubberstation/code/modules/shuttle/misc/shuttle_remote.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

152 lines
6.6 KiB
Plaintext

/obj/item/shuttle_remote
name = "shuttle remote"
desc = "A remote to send away or call a shuttle."
icon = 'icons/obj/devices/remote.dmi'
icon_state = "shuttleremote"
w_class = WEIGHT_CLASS_SMALL
custom_materials = list(/datum/material/gold = SHEET_MATERIAL_AMOUNT, /datum/material/bluespace = HALF_SHEET_MATERIAL_AMOUNT, /datum/material/iron = SMALL_MATERIAL_AMOUNT * 2, /datum/material/glass = SMALL_MATERIAL_AMOUNT)
/// if the docks may be changed
var/may_change_docks = TRUE //if this is set to FALSE make sure the shuttle it will be linked to does NOT get to have multiple instances of itself
/// the port where the shuttle leaves to
var/shuttle_away_id = "whiteship_lavaland"
/// the port where the shuttle returns to
var/shuttle_home_id = "whiteship_home"
/// var which will hold the nav computer
var/datum/weakref/computer_ref
/// var which will hold the mobile port
var/obj/docking_port/mobile/our_port
/obj/item/shuttle_remote/add_context(atom/source, list/context, obj/item/held_item, mob/user)
. = ..()
var/obj/machinery/computer/shuttle/our_computer = computer_ref?.resolve()
if(may_change_docks && our_computer)
context[SCREENTIP_CONTEXT_LMB] = "Use"
context[SCREENTIP_CONTEXT_ALT_RMB] = "Change Shuttle Docks"
/obj/item/shuttle_remote/examine(mob/user)
. = ..()
var/obj/machinery/computer/shuttle/our_computer = computer_ref?.resolve()
if(may_change_docks && our_computer)
. += span_notice("You can change where the [get_area_name(SSshuttle.getShuttle(our_computer.shuttleId))] docks using [EXAMINE_HINT("alt-right-click")].")
/obj/item/shuttle_remote/Initialize(mapload)
. = ..()
if(!mapload)
return
var/obj/machinery/computer/shuttle/computer = locate(/obj/machinery/computer/shuttle) in loc
if(!computer)
return
computer.remote_ref = WEAKREF(src)
computer_ref = WEAKREF(computer)
/obj/item/shuttle_remote/interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
var/obj/machinery/computer/shuttle/our_computer = computer_ref?.resolve()
if(!istype(interacting_with, /obj/machinery/computer/shuttle))
return NONE
if(our_computer || our_port)
balloon_alert(user, "already linked!")
return ITEM_INTERACT_BLOCKING
var/obj/machinery/computer/shuttle/new_computer = interacting_with
if(new_computer.remote_ref || !new_computer.may_be_remote_controlled)
balloon_alert(user, "occupied signal!")
return ITEM_INTERACT_BLOCKING
new_computer.remote_ref = WEAKREF(src)
computer_ref = WEAKREF(new_computer)
our_port = SSshuttle.getShuttle(new_computer.shuttleId)
playsound(src, 'sound/machines/beep/beep.ogg', 30)
balloon_alert(user, "linked")
return ITEM_INTERACT_SUCCESS
/obj/item/shuttle_remote/attack_self(mob/user)
var/obj/machinery/computer/shuttle/our_computer = computer_ref?.resolve()
if(!our_port)
our_port = SSshuttle.getShuttle(our_computer.shuttleId) //incase we were maploaded
if(!can_use(user))
return
var/obj/docking_port/home = SSshuttle.getDock(shuttle_home_id)
var/obj/docking_port/away = SSshuttle.getDock(shuttle_away_id)
var/obj/docking_port/dock = our_port.get_docked()
var/send_off_text = "Are you sure you want to send off [get_area_name(SSshuttle.getShuttle(our_computer.shuttleId))] to [away.name]?"
var/list/send_off_options = list("Yes", "No")
var/destination = null
if(home == dock || ("[our_computer.shuttleId]_custom" == dock.shuttle_id))
switch(tgui_alert(user, send_off_text, "Send Off Shuttle?", send_off_options))
if("Yes")
destination = away.shuttle_id
else if(away == dock)
send_off_text = "Are you sure you want to call [get_area_name(SSshuttle.getShuttle(our_computer.shuttleId))] to [home.name]?"
for(var/list/possible_destinations in our_computer.get_valid_destinations())
if(LAZYACCESS(possible_destinations, "id") == "[our_computer.shuttleId]_custom")
send_off_text += "\n\nCustom location loaded, try to dock?"
send_off_options += "Send to custom"
break
switch(tgui_alert(user, send_off_text, "Call Shuttle?", send_off_options))
if("Yes")
destination = home.shuttle_id
if("Send to custom")
destination = "[our_computer.shuttleId]_custom"
if(!destination || !can_use(user))
return
if(!our_port.canDock(SSshuttle.getDock(destination)))
balloon_alert(user, "destination occupied!")
return
transit_shuttle(user, destination)
/obj/item/shuttle_remote/click_alt_secondary(mob/user)
var/obj/machinery/computer/shuttle/our_computer = computer_ref?.resolve()
if(!may_change_docks || !our_computer)
return NONE
var/list/destinations_list = our_computer.get_valid_destinations()
var/list/destination_names = list()
var/list/destination_ids = list()
for(var/list/destination_data in destinations_list)
if((destination_data["id"] == shuttle_away_id) || (destination_data["id"] == shuttle_home_id))
continue //don't display ports that are already designated
if(destination_data["id"] == "[our_computer.shuttleId]_custom")
continue //we already handle custom docking
LAZYADD(destination_names, destination_data["name"])
LAZYADDASSOC(destination_ids, destination_data["name"], destination_data["id"])
if(destination_names.len < 1)
balloon_alert(user, "no valid destinations!")
return NONE
var/picked_home = tgui_input_list(user, "choose which dock to designate as the shuttle's home point...", "Choose Home Dock", destination_names)
var/picked_away = tgui_input_list(user, "choose which dock to designate as the shuttle's away point...", "Choose Away Dock", destination_names)
if(picked_home && can_use(user))
shuttle_home_id = LAZYACCESS(destination_ids, picked_home)
if(picked_away && can_use(user))
shuttle_away_id = LAZYACCESS(destination_ids, picked_away)
return CLICK_ACTION_SUCCESS
/obj/item/shuttle_remote/proc/can_use(mob/user)
var/obj/machinery/computer/shuttle/our_computer = computer_ref?.resolve()
if(!user.can_perform_action(src))
return FALSE
if(is_reserved_level(loc.z))
balloon_alert(user, "can't use here!")
return FALSE
if(!our_computer)
balloon_alert(user, "no nav computer!")
return FALSE
if(our_computer.locked)
balloon_alert(user, "nav computer locked!")
return FALSE
if(our_port.mode != SHUTTLE_IDLE)
balloon_alert(user, "engines recharging!")
return FALSE
if(!our_port.canDock(SSshuttle.getDock(shuttle_home_id)))
balloon_alert(user, "home dock occupied!")
return FALSE
if(!our_port.canDock(SSshuttle.getDock(shuttle_away_id)))
balloon_alert(user, "away dock occupied!")
return FALSE
return TRUE
/obj/item/shuttle_remote/proc/transit_shuttle(mob/user, destination)
var/obj/machinery/computer/shuttle/our_computer = computer_ref?.resolve()
our_computer.send_shuttle(destination, user)
our_computer.destination = destination