Refactors how circuit size is calculated. Fixed module circuit size not taking up capacity equal to the amount of circuit components inside of it. (#61554)

Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com>
This commit is contained in:
Watermelon914
2021-09-30 11:09:42 -07:00
committed by GitHub
co-authored by Watermelon914
parent f109d9d654
commit 1a507d23ed
6 changed files with 36 additions and 5 deletions
+13 -2
View File
@@ -45,12 +45,15 @@
/// The power usage whenever this component receives an input
var/power_usage_per_input = 1
// Whether the component is removable or not. Only affects user UI
/// Whether the component is removable or not. Only affects user UI
var/removable = TRUE
// Defines which shells support this component. Only used as an informational guide, does not restrict placing these components in circuits.
/// Defines which shells support this component. Only used as an informational guide, does not restrict placing these components in circuits.
var/required_shells = null
/// Determines the amount of space this circuit occupies in an integrated circuit.
var/circuit_size = 1
/// The UI buttons of this circuit component. An assoc list that has this format: "button_icon" = "action_name"
var/ui_buttons = null
@@ -216,6 +219,14 @@
trigger_output.set_output(COMPONENT_SIGNAL)
return TRUE
/obj/item/circuit_component/proc/set_circuit_size(new_size)
if(parent)
parent.current_size -= circuit_size
circuit_size = new_size
if(parent)
parent.current_size += circuit_size
/**
* Called whether this circuit component should receive an input.