Adds circutry to diagnostic hud, adds action flags to circuits (#35718)
cl add: Circuits integrity, charge, and overall circuit composition is displayed on diagnostic huds. If the assembly has dangerous circuits then the status icon will display exclamation points, if the assembly can communicate with something far away a wifi icon will appear next to the status icon, and if the circuit can not operate the status icon will display an 'X'. add: AR interface circuit which can modify the status icon if it is not displaying the exclamation points or the 'X'. tweak: Locomotive circuits can no longer be added to assemblies that can't use them. spellcheck: Fixed a typo in the grenade primer description. code: Added flags to circuits that help group subsets of circuits and regulate them. /cl The diagnostic hud addition is meant to allow more counter play to circuits by seeing the assemblies's healths and how dangerous they are. The flags are a useful addition to the code because players shouldn't be able to put circuits in assemblies if the assembly can't use that circuit (this can also be used later for other assemblies which could use unique circuits). The following circuits are flagged as dangerous: weapon firing mechanism grenade primer thrower The following circuits are flagged as long range: NTNet networking circuit integrated signaler video camera circuit possible AR interface displays: default alert move
This commit is contained in:
committed by
CitadelStationBot
parent
fef23bd7cc
commit
108f1c85ff
@@ -20,6 +20,11 @@
|
||||
var/charge_tick = FALSE
|
||||
var/charge_delay = 4
|
||||
var/use_cyborg_cell = TRUE
|
||||
var/allowed_circuit_action_flags = IC_ACTION_COMBAT | IC_ACTION_LONG_RANGE //which circuit flags are allowed
|
||||
var/combat_circuits = 0 //number of combat cicuits in the assembly, used for diagnostic hud
|
||||
var/long_range_circuits = 0 //number of long range cicuits in the assembly, used for diagnostic hud
|
||||
var/prefered_hud_icon = "hudstat" // Used by the AR circuit to change the hud icon.
|
||||
hud_possible = list(DIAG_STAT_HUD, DIAG_BATT_HUD, DIAG_TRACK_HUD, DIAG_CIRCUIT_HUD) //diagnostic hud overlays
|
||||
max_integrity = 50
|
||||
armor = list("melee" = 50, "bullet" = 70, "laser" = 70, "energy" = 100, "bomb" = 10, "bio" = 100, "rad" = 100, "fire" = 0, "acid" = 0)
|
||||
|
||||
@@ -32,14 +37,29 @@
|
||||
START_PROCESSING(SScircuit, src)
|
||||
materials[MAT_METAL] = round((max_complexity + max_components) / 4) * SScircuit.cost_multiplier
|
||||
|
||||
//sets up diagnostic hud view
|
||||
prepare_huds()
|
||||
for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds)
|
||||
diag_hud.add_to_hud(src)
|
||||
diag_hud_set_circuithealth()
|
||||
diag_hud_set_circuitcell()
|
||||
diag_hud_set_circuitstat()
|
||||
diag_hud_set_circuittracking()
|
||||
|
||||
/obj/item/device/electronic_assembly/Destroy()
|
||||
STOP_PROCESSING(SScircuit, src)
|
||||
for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds)
|
||||
diag_hud.remove_from_hud(src)
|
||||
return ..()
|
||||
|
||||
/obj/item/device/electronic_assembly/process()
|
||||
handle_idle_power()
|
||||
check_pulling()
|
||||
|
||||
//updates diagnostic hud
|
||||
diag_hud_set_circuithealth()
|
||||
diag_hud_set_circuitcell()
|
||||
|
||||
/obj/item/device/electronic_assembly/proc/handle_idle_power()
|
||||
// First we generate power.
|
||||
for(var/obj/item/integrated_circuit/passive/power/P in assembly_components)
|
||||
@@ -127,6 +147,7 @@
|
||||
playsound(src, 'sound/items/Crowbar.ogg', 50, 1)
|
||||
to_chat(usr, "<span class='notice'>You pull \the [battery] out of \the [src]'s power supplier.</span>")
|
||||
battery = null
|
||||
diag_hud_set_circuitstat() //update diagnostic hud
|
||||
|
||||
if(href_list["component"])
|
||||
var/obj/item/integrated_circuit/component = locate(href_list["component"]) in assembly_components
|
||||
@@ -170,6 +191,22 @@
|
||||
|
||||
interact(usr) // To refresh the UI.
|
||||
|
||||
/obj/item/device/electronic_assembly/pickup(mob/living/user)
|
||||
. = ..()
|
||||
//update diagnostic hud when picked up, true is used to force the hud to be hidden
|
||||
diag_hud_set_circuithealth(TRUE)
|
||||
diag_hud_set_circuitcell(TRUE)
|
||||
diag_hud_set_circuitstat(TRUE)
|
||||
diag_hud_set_circuittracking(TRUE)
|
||||
|
||||
/obj/item/device/electronic_assembly/dropped(mob/user)
|
||||
. = ..()
|
||||
//update diagnostic hud when dropped
|
||||
diag_hud_set_circuithealth()
|
||||
diag_hud_set_circuitcell()
|
||||
diag_hud_set_circuitstat()
|
||||
diag_hud_set_circuittracking()
|
||||
|
||||
/obj/item/device/electronic_assembly/proc/rename()
|
||||
var/mob/M = usr
|
||||
if(!check_interactivity(M))
|
||||
@@ -232,6 +269,9 @@
|
||||
if((total_complexity + IC.complexity) > max_complexity)
|
||||
to_chat(user, "<span class='warning'>You can't seem to add the '[IC]', since this setup's too complicated for the case.</span>")
|
||||
return FALSE
|
||||
if((allowed_circuit_action_flags & IC.action_flags) != IC.action_flags)
|
||||
to_chat(user, "<span class='warning'>You can't seem to add the '[IC]', since the case doesn't support the circuit type.</span>")
|
||||
return FALSE
|
||||
|
||||
if(!user.transferItemToLoc(IC, src))
|
||||
return FALSE
|
||||
@@ -249,6 +289,16 @@
|
||||
component.assembly = src
|
||||
assembly_components |= component
|
||||
|
||||
//increment numbers for diagnostic hud
|
||||
if(component.action_flags & IC_ACTION_COMBAT)
|
||||
combat_circuits += 1;
|
||||
if(component.action_flags & IC_ACTION_LONG_RANGE)
|
||||
long_range_circuits += 1;
|
||||
|
||||
//diagnostic hud update
|
||||
diag_hud_set_circuitstat()
|
||||
diag_hud_set_circuittracking()
|
||||
|
||||
|
||||
/obj/item/device/electronic_assembly/proc/try_remove_component(obj/item/integrated_circuit/IC, mob/user, silent)
|
||||
if(!opened)
|
||||
@@ -276,6 +326,16 @@
|
||||
component.assembly = null
|
||||
assembly_components.Remove(component)
|
||||
|
||||
//decriment numbers for diagnostic hud
|
||||
if(component.action_flags & IC_ACTION_COMBAT)
|
||||
combat_circuits -= 1;
|
||||
if(component.action_flags & IC_ACTION_LONG_RANGE)
|
||||
long_range_circuits -= 1;
|
||||
|
||||
//diagnostic hud update
|
||||
diag_hud_set_circuitstat()
|
||||
diag_hud_set_circuittracking()
|
||||
|
||||
|
||||
/obj/item/device/electronic_assembly/afterattack(atom/target, mob/user, proximity)
|
||||
for(var/obj/item/integrated_circuit/input/S in assembly_components)
|
||||
@@ -313,6 +373,7 @@
|
||||
user.transferItemToLoc(I, loc)
|
||||
cell.forceMove(src)
|
||||
battery = cell
|
||||
diag_hud_set_circuitstat() //update diagnostic hud
|
||||
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
to_chat(user, "<span class='notice'>You slot \the [cell] inside \the [src]'s power supplier.</span>")
|
||||
interact(user)
|
||||
@@ -498,6 +559,7 @@
|
||||
w_class = WEIGHT_CLASS_BULKY
|
||||
max_components = IC_MAX_SIZE_BASE * 3
|
||||
max_complexity = IC_COMPLEXITY_BASE * 3
|
||||
allowed_circuit_action_flags = IC_ACTION_MOVEMENT | IC_ACTION_COMBAT | IC_ACTION_LONG_RANGE
|
||||
|
||||
/obj/item/device/electronic_assembly/drone/can_move()
|
||||
return TRUE
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
var/power_draw_per_use = 0 // How much power is drawn when work()'d.
|
||||
var/power_draw_idle = 0 // How much power is drawn when doing nothing.
|
||||
var/spawn_flags // Used for world initializing, see the #defines above.
|
||||
var/action_flags = NONE // Used for telling circuits that can do certain actions from other circuits.
|
||||
var/category_text = "NO CATEGORY THIS IS A BUG" // To show up on circuit printer, and perhaps other places.
|
||||
var/removable = TRUE // Determines if a circuit is removable from the assembly.
|
||||
var/displayed_name = ""
|
||||
|
||||
@@ -171,6 +171,11 @@
|
||||
var/obj/item/device/electronic_assembly/E = built
|
||||
E.opened = TRUE
|
||||
E.update_icon()
|
||||
//reupdate diagnostic hud because it was put_in_hands() and not pickup()'ed
|
||||
E.diag_hud_set_circuithealth()
|
||||
E.diag_hud_set_circuitcell()
|
||||
E.diag_hud_set_circuitstat()
|
||||
E.diag_hud_set_circuittracking()
|
||||
|
||||
to_chat(usr, "<span class='notice'>[capitalize(built.name)] printed.</span>")
|
||||
playsound(src, 'sound/items/jaws_pry.ogg', 50, TRUE)
|
||||
@@ -205,6 +210,8 @@
|
||||
to_chat(usr, "<span class='notice'>It uses advanced component designs.</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>It uses unknown component designs. Printer upgrade is required to proceed.</span>")
|
||||
if(program["unsupported_circuit"])
|
||||
to_chat(usr, "<span class='warning'>This program uses components not supported by the specified assembly. Please change the assembly type in the save file to a supported one.</span>")
|
||||
to_chat(usr, "<span class='notice'>Used space: [program["used_space"]]/[program["max_space"]].</span>")
|
||||
to_chat(usr, "<span class='notice'>Complexity: [program["complexity"]]/[program["max_complexity"]].</span>")
|
||||
to_chat(usr, "<span class='notice'>Metal cost: [program["metal_cost"]].</span>")
|
||||
@@ -215,6 +222,8 @@
|
||||
|
||||
if(program["requires_upgrades"] && !upgraded)
|
||||
to_chat(usr, "<span class='warning'>This program uses unknown component designs. Printer upgrade is required to proceed.</span>")
|
||||
if(program["unsupported_circuit"])
|
||||
to_chat(usr, "<span class='warning'>This program uses components not supported by the specified assembly. Please change the assembly type in the save file to a supported one.</span>")
|
||||
else
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
if(materials.use_amount_type(program["metal_cost"], MAT_METAL))
|
||||
|
||||
@@ -204,7 +204,7 @@
|
||||
// Returns assembly (type: list) if the save is valid.
|
||||
// Returns error code (type: text) if loading has failed.
|
||||
// The following parameters area calculated during validation and added to the returned save list:
|
||||
// "requires_upgrades", "metal_cost", "complexity", "max_complexity", "used_space", "max_space"
|
||||
// "requires_upgrades", "unsupported_circuit", "metal_cost", "complexity", "max_complexity", "used_space", "max_space"
|
||||
/datum/controller/subsystem/processing/circuit/proc/validate_electronic_assembly(program)
|
||||
var/list/blocks = json_decode(program)
|
||||
if(!blocks)
|
||||
@@ -275,6 +275,10 @@
|
||||
if(!(component.spawn_flags & IC_SPAWN_DEFAULT))
|
||||
blocks["requires_upgrades"] = TRUE
|
||||
|
||||
// Check if the assembly supports the circucit
|
||||
if((component.action_flags & assembly.allowed_circuit_action_flags) != component.action_flags)
|
||||
blocks["unsupported_circuit"] = TRUE
|
||||
|
||||
|
||||
// Check complexity and space limitations
|
||||
if(blocks["used_space"] > blocks["max_space"])
|
||||
|
||||
Reference in New Issue
Block a user