mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-14 17:45:02 +01:00
Adds power to arithmetic components (#93913)
## About The Pull Request Arithmetic circuit components are given the ability to calculate powers. ## Why It's Good For The Game This is necessary for certain calculations like finding the distance between two points, allowing greater creativity in circuit design. ## Changelog 🆑 add: Added powers to arithmetic circuit components. /🆑
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#define COMP_ARITHMETIC_MODULO "Modulo"
|
||||
#define COMP_ARITHMETIC_MIN "Minimum"
|
||||
#define COMP_ARITHMETIC_MAX "Maximum"
|
||||
#define COMP_ARITHMETIC_POWER "Power"
|
||||
|
||||
/**
|
||||
* # Arithmetic Component
|
||||
@@ -38,6 +39,7 @@
|
||||
COMP_ARITHMETIC_MODULO,
|
||||
COMP_ARITHMETIC_MIN,
|
||||
COMP_ARITHMETIC_MAX,
|
||||
COMP_ARITHMETIC_POWER,
|
||||
)
|
||||
arithmetic_option = add_option_port("Arithmetic Option", component_options)
|
||||
|
||||
@@ -83,6 +85,8 @@
|
||||
result = max(result, value)
|
||||
if(COMP_ARITHMETIC_MIN)
|
||||
result = min(result, value)
|
||||
if(COMP_ARITHMETIC_POWER)
|
||||
result = result ** value
|
||||
|
||||
output.set_output(result)
|
||||
|
||||
@@ -93,3 +97,4 @@
|
||||
#undef COMP_ARITHMETIC_MODULO
|
||||
#undef COMP_ARITHMETIC_MIN
|
||||
#undef COMP_ARITHMETIC_MAX
|
||||
#undef COMP_ARITHMETIC_POWER
|
||||
|
||||
Reference in New Issue
Block a user