mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-13 08:56:49 +01:00
5277251959
For a robust crafting system, I need a new materials framework. For a new materials framework, I need to clean up reagents. To clean up reagents, I need to pare down foods from reagent holders. To pare down foods from reagent holders, I need to port edibility components. To port edibility components, I need to port processing components. To port processing components, I need to port tool behaviors. This is all back-end code, no new features or functionality from this.
158 lines
5.6 KiB
Plaintext
158 lines
5.6 KiB
Plaintext
/obj/item/mech_component/sensors
|
|
name = "head"
|
|
pixel_y = -18
|
|
center_of_mass = list("x"=24, "y"=34)
|
|
icon_state = "loader_head"
|
|
gender = NEUTER
|
|
|
|
var/vision_flags = 0
|
|
var/lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE
|
|
var/see_invisible = 0
|
|
var/obj/item/robot_parts/robot_component/radio/radio
|
|
var/obj/item/robot_parts/robot_component/camera/camera
|
|
var/obj/item/mech_component/control_module/software
|
|
var/active_sensors = 0
|
|
has_hardpoints = list(HARDPOINT_HEAD)
|
|
power_use = 15
|
|
|
|
/obj/item/mech_component/sensors/Destroy()
|
|
QDEL_NULL(camera)
|
|
QDEL_NULL(radio)
|
|
QDEL_NULL(software)
|
|
. = ..()
|
|
|
|
/obj/item/mech_component/sensors/get_missing_parts_text()
|
|
. = ..()
|
|
|
|
if(!radio)
|
|
. += SPAN_WARNING("It is missing a <a href='byond://?src=[REF(src)];info=radio'>radio</a>.")
|
|
if(!camera)
|
|
. += SPAN_WARNING("It is missing a <a href='byond://?src=[REF(src)];info=camera'>camera</a>.")
|
|
if(!software)
|
|
. += SPAN_WARNING("It is missing an <a href='byond://?src=[REF(src)];info=module'>exosuit control module</a>.")
|
|
|
|
/obj/item/mech_component/sensors/Topic(href, href_list)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
switch(href_list["info"])
|
|
if("radio")
|
|
to_chat(usr, SPAN_NOTICE("A radio can be created at a synthetic fabricator."))
|
|
if("camera")
|
|
to_chat(usr, SPAN_NOTICE("A camera can be created at a synthetic fabricator."))
|
|
if("module")
|
|
to_chat(usr, SPAN_NOTICE("An exosuit control module can be created at a synthetic fabricator, while the software chips it uses can be printed at the circuit imprinter."))
|
|
|
|
/obj/item/mech_component/sensors/return_diagnostics(mob/user)
|
|
..()
|
|
if(software)
|
|
to_chat(user, SPAN_NOTICE(" Installed Software"))
|
|
for(var/exosystem_software in software.installed_software)
|
|
to_chat(user, SPAN_NOTICE(" - <b>[capitalize_first_letters(exosystem_software)]</b>"))
|
|
else
|
|
to_chat(user, SPAN_WARNING(" - Control Module Missing or Non-functional."))
|
|
if(radio)
|
|
to_chat(user, SPAN_NOTICE(" - Radio Integrity: <b>[round(((radio.max_dam - radio.total_dam) / radio.max_dam) * 100, 0.1)]%</b>"))
|
|
else
|
|
to_chat(user, SPAN_WARNING(" - Radio Missing or Non-functional."))
|
|
|
|
/obj/item/mech_component/sensors/prebuild()
|
|
radio = new(src)
|
|
camera = new(src)
|
|
|
|
/obj/item/mech_component/sensors/update_components()
|
|
radio = locate() in src
|
|
camera = locate() in src
|
|
software = locate() in src
|
|
|
|
/obj/item/mech_component/sensors/proc/get_sight(powered)
|
|
var/flags = 0
|
|
if((total_damage >= 0.8 * max_damage) || !powered)
|
|
flags |= BLIND
|
|
else if(active_sensors && powered)
|
|
flags |= vision_flags
|
|
|
|
return flags
|
|
|
|
/obj/item/mech_component/sensors/proc/get_invisible(powered)
|
|
var/invisible = 0
|
|
if((total_damage <= 0.8 * max_damage) && active_sensors && powered)
|
|
invisible = see_invisible
|
|
return invisible
|
|
|
|
/obj/item/mech_component/sensors/proc/get_lighting_alpha(powered)
|
|
var/l_alpha = 0
|
|
if((total_damage <= 0.8 * max_damage) && active_sensors && powered)
|
|
l_alpha = lighting_alpha
|
|
return l_alpha
|
|
|
|
/obj/item/mech_component/sensors/ready_to_install()
|
|
return (radio && camera)
|
|
|
|
/obj/item/mech_component/sensors/attackby(obj/item/attacking_item, mob/user)
|
|
if(istype(attacking_item, /obj/item/mech_component/control_module))
|
|
if(software)
|
|
to_chat(user, SPAN_WARNING("\The [src] already has a control modules installed."))
|
|
return
|
|
if(install_component(attacking_item, user)) software = attacking_item
|
|
else if(istype(attacking_item,/obj/item/robot_parts/robot_component/radio))
|
|
if(radio)
|
|
to_chat(user, SPAN_WARNING("\The [src] already has a radio installed."))
|
|
return
|
|
if(install_component(attacking_item, user)) radio = attacking_item
|
|
else if(istype(attacking_item,/obj/item/robot_parts/robot_component/camera))
|
|
if(camera)
|
|
to_chat(user, SPAN_WARNING("\The [src] already has a camera installed."))
|
|
return
|
|
if(install_component(attacking_item, user)) camera = attacking_item
|
|
else
|
|
return ..()
|
|
|
|
/obj/item/mech_component/control_module
|
|
name = "exosuit control module"
|
|
desc = "A clump of circuitry and software chip docks, used to program exosuits."
|
|
icon_state = "control"
|
|
icon = 'icons/mecha/mech_equipment.dmi'
|
|
gender = NEUTER
|
|
var/list/installed_software = list()
|
|
var/max_installed_software = 2
|
|
|
|
/obj/item/mech_component/control_module/get_examine_text(mob/user, distance, is_adjacent, infix, suffix)
|
|
. = ..()
|
|
. += SPAN_NOTICE("<a href='byond://?src=[REF(src)];info=software'>It has [max_installed_software - LAZYLEN(installed_software)] empty slot\s remaining out of [max_installed_software].</a>")
|
|
|
|
/obj/item/mech_component/control_module/Topic(href, href_list)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
switch(href_list["info"])
|
|
if("software")
|
|
to_chat(usr, SPAN_NOTICE("Software for \the [src] can be created at the circuit imprinter."))
|
|
|
|
/obj/item/mech_component/control_module/attackby(obj/item/attacking_item, mob/user)
|
|
if(istype(attacking_item, /obj/item/circuitboard/exosystem))
|
|
install_software(attacking_item, user)
|
|
return
|
|
else if(attacking_item.tool_behaviour == TOOL_SCREWDRIVER)
|
|
var/result = ..()
|
|
update_software()
|
|
return result
|
|
else
|
|
return ..()
|
|
|
|
/obj/item/mech_component/control_module/proc/install_software(var/obj/item/circuitboard/exosystem/software, var/mob/user)
|
|
if(installed_software.len >= max_installed_software)
|
|
if(user)
|
|
to_chat(user, SPAN_WARNING("\The [src] can only hold [max_installed_software] software modules."))
|
|
return
|
|
if(user)
|
|
to_chat(user, SPAN_NOTICE("You load \the [software] into \the [src]'s memory."))
|
|
user.unEquip(software)
|
|
software.forceMove(src)
|
|
update_software()
|
|
|
|
/obj/item/mech_component/control_module/proc/update_software()
|
|
installed_software = list()
|
|
for(var/obj/item/circuitboard/exosystem/program in contents)
|
|
installed_software |= program.contains_software
|