-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Circuit editor QoL and new circuit components (#82969)
## About The Pull Request This PR introduces a number of minor quality of life improvements to already existing circuit components, and adds three new components. <img width="600" alt="preview" src="https://github.com/tgstation/tgstation/assets/80724828/85d39b6d-b055-430e-8996-0da088616887"> ## Why It's Good For The Game This improves the overall experience for circuits. ### UI changes <img width="550" alt="grid aligned" src="https://github.com/tgstation/tgstation/assets/80724828/cc7b43b5-292f-4643-beab-e01ae675fb19"> Grid align is now an option for circuit designers. It will round objects to the nearest 10px units internally, and can be toggled on/off by the new additional button beside the component menu button. This makes circuits easier on the eyes as things are pixel perfect aligned. <img width="814" alt="tooltips" src="https://github.com/tgstation/tgstation/assets/80724828/0d31c98f-3be9-46e0-ab37-20bac3799112"> All three buttons have been given tool tips. ### Tweaked Components <img width="136" alt="voice activator" src="https://github.com/tgstation/tgstation/assets/80724828/21dd0f65-cb98-4bd5-aeb0-63315e842cb6"> * Adds a on/off flag to the voice activator component -- This saves power for circuits as you're not forced to use a compare flag check to turn off voice activation <img width="136" alt="speech" src="https://github.com/tgstation/tgstation/assets/80724828/9137b76c-3077-4597-8411-2d9694b39e9e"> * Adds a quiet mode flag to speech component -- This is ideal when you want a device to speak, but don't want other people to hear. A good example would be a handheld translator that you only want to hear yourself. ### New Components <img width="136" alt="ntnet list literal" src="https://github.com/tgstation/tgstation/assets/80724828/657c851b-d442-4a63-8650-410cb8e76089"> * An NTNet Send component that allows everything to be input much like the list literal component -- This makes sending stuff over NTNet easier for the user, and use less power as it won't require an additional list literal component <img width="136" alt="compare health state" src="https://github.com/tgstation/tgstation/assets/80724828/0bed076c-3aa1-4931-af90-2b9eb8e1ae9a"> * A health comparison component that checks the entity's health state, and can return true or false depending if the entity is alive, sleeping, unconscious, critical or dead -- This could be achieved by using a health sensor and a compare component, however it lacks the ability to know when a entity is unconscious or sleeping <img width="136" alt="toggle" src="https://github.com/tgstation/tgstation/assets/80724828/7017b6bf-937a-42ad-87f3-4f1134853ac3"> * A quick toggle component to allow the switching between a true and false state -- This could be achieved by using a logic component and self linking, however this makes it far easier for newcomers to make something as simple as an on/off switch (such as a handheld translator which uses the front button to turn on/off) ## Changelog :cl: qol: Add tooltips to circuit editor buttons qol: Add grid alignment mode to circuit editor add: Added new compare health state component add: Added new NTNet send list literal component add: Added new toggle component qol: Added activity toggle to voice activator component qol: Added quiet mode to speech component qol: NTNet send component will not use power/trigger if NTNet is offline /:cl:
- Loading branch information
Showing
13 changed files
with
209 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* # Compare Health State Component | ||
* | ||
* Returns true when state matches entity. | ||
*/ | ||
|
||
/obj/item/circuit_component/compare/health_state | ||
display_name = "Compare Health State" | ||
desc = "A component that compares the health state of an organism, and returns true or false." | ||
category = "Entity" | ||
|
||
/// The input port | ||
var/datum/port/input/input_port | ||
|
||
/// Compare state option | ||
var/datum/port/input/option/state_option | ||
|
||
var/max_range = 5 | ||
|
||
/obj/item/circuit_component/compare/health_state/get_ui_notices() | ||
. = ..() | ||
. += create_ui_notice("Maximum Range: [max_range] tiles", "orange", "info") | ||
|
||
/obj/item/circuit_component/compare/health_state/populate_options() | ||
input_port = add_input_port("Organism", PORT_TYPE_ATOM) | ||
|
||
var/static/component_options = list( | ||
"Alive", | ||
"Asleep", | ||
"Critical", | ||
"Unconscious", | ||
"Deceased", | ||
) | ||
state_option = add_option_port("Comparison Option", component_options) | ||
|
||
/obj/item/circuit_component/compare/health_state/do_comparisons() | ||
var/mob/living/organism = input_port.value | ||
var/turf/current_turf = get_location() | ||
if(!istype(organism) || current_turf.z != organism.z || get_dist(current_turf, organism) > max_range) | ||
return FALSE | ||
|
||
var/current_option = state_option.value | ||
var/state = organism.stat | ||
switch(current_option) | ||
if("Alive") | ||
return state != DEAD | ||
if("Asleep") | ||
return !!organism.IsSleeping() && !organism.IsUnconscious() | ||
if("Critical") | ||
return state == SOFT_CRIT || state == HARD_CRIT | ||
if("Unconscious") | ||
return state == UNCONSCIOUS || state == HARD_CRIT || !!organism.IsUnconscious() | ||
if("Deceased") | ||
return state == DEAD | ||
//Unknown state, something fucked up really bad - just return false | ||
return FALSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* # Toggle Component | ||
* | ||
* Does a toggle between true and false on trigger | ||
*/ | ||
/obj/item/circuit_component/compare/toggle | ||
display_name = "Toggle" | ||
desc = "A component that toggles between on and off when triggered. All input ports (except for set toggle) will trigger the component." | ||
category = "Math" | ||
|
||
/// A signal to reset the toggle back to 0 | ||
var/datum/port/input/toggle_set | ||
/// A signal to toggle and return the current state | ||
var/datum/port/input/toggle_and_compare | ||
|
||
var/toggle_state = FALSE | ||
|
||
/obj/item/circuit_component/compare/toggle/populate_custom_ports() | ||
toggle_set = add_input_port("Set Toggle State", PORT_TYPE_NUMBER) | ||
toggle_and_compare = add_input_port("Toggle And Compare", PORT_TYPE_SIGNAL) | ||
toggle_state = FALSE | ||
|
||
/obj/item/circuit_component/compare/toggle/input_received(datum/port/input/port) | ||
if(port == toggle_set) | ||
toggle_state = !!port.value | ||
return | ||
if(COMPONENT_TRIGGERED_BY(toggle_and_compare, port)) | ||
toggle_state = !toggle_state | ||
if(toggle_state) | ||
true.set_output(COMPONENT_SIGNAL) | ||
else | ||
false.set_output(COMPONENT_SIGNAL) | ||
return ..() | ||
|
||
/obj/item/circuit_component/compare/toggle/do_comparisons() | ||
return toggle_state |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
code/modules/wiremod/components/ntnet/ntnet_send_literal.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* # NTNet Transmitter List Literal Component | ||
* | ||
* Create a list literal and send a data package through NTNet | ||
* | ||
* This file is based off of ntnet_send.dm | ||
* Any changes made to those files should be copied over with discretion | ||
*/ | ||
/obj/item/circuit_component/list_literal/ntnet_send | ||
display_name = "NTNet Transmitter List Literal" | ||
desc = "Creates a list literal data package and sends it through NTNet. If Encryption Key is set then transmitted data will be only picked up by receivers with the same Encryption Key." | ||
category = "NTNet" | ||
|
||
/// Encryption key | ||
var/datum/port/input/enc_key | ||
|
||
/obj/item/circuit_component/list_literal/ntnet_send/populate_ports() | ||
. = ..() | ||
enc_key = add_input_port("Encryption Key", PORT_TYPE_STRING) | ||
|
||
/obj/item/circuit_component/list_literal/ntnet_send/should_receive_input(datum/port/input/port) | ||
. = ..() | ||
if(!.) | ||
return FALSE | ||
/// If the server is down, don't use power or attempt to send data | ||
return find_functional_ntnet_relay() | ||
|
||
/obj/item/circuit_component/list_literal/ntnet_send/input_received(datum/port/input/port) | ||
. = ..() | ||
send_ntnet_data(list_output, enc_key.value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.