Skip to content

Commit

Permalink
More maintenance for turbine (tgstation#88254)
Browse files Browse the repository at this point in the history
## About The Pull Request
**1. Fixes**
 - Fixes tgstation#88231. This is a 2 part fix as in
- For the UI side we first convert energy to power in the back end via
`energy_to_power()` proc & then use `formatPower()` proc in the client
side UI to display the correct SI units instead of always using KW
- The turbine now uses `SSMachines` subsytem for processing instead of
`SSAir`. This is because energy which is
[power x delta time] requires `seconds_per_tick` which isn't supplied by
`process_atmos()` so for correct conversion we have to switch over to
the machine subsystem
 
![Screenshot
(452)](https://github.com/user-attachments/assets/94fc207b-37d4-4f10-a984-b5d15e0644c6)


**2. Refactor**
- Merged procs like `power_on()` & `power_off()` both into
`toggle_power()` proc
  - Converted `attackby()` attack chain into `item_interaction()`
- `ui_data()` now won't update the UI if it encounters invalid data &
sends very little data if it's not connected to the turbine to reduce
bandwidth
  - Removes redundant vars, autodoc procs & much more

## Changelog
:cl:
fix: Turbine converts energy to power correctly & shows correct reading
with multitool
refactor: turbine code has been overall improved. report bugs on github
/:cl:
  • Loading branch information
SyncIt21 authored Dec 15, 2024
1 parent 67e03c4 commit d1b8423
Show file tree
Hide file tree
Showing 7 changed files with 330 additions and 334 deletions.
1 change: 0 additions & 1 deletion code/game/machinery/_machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,6 @@

///internal proc that removes all static power usage from the current area
/obj/machinery/proc/unset_static_power()
PRIVATE_PROC(TRUE)
SHOULD_NOT_OVERRIDE(TRUE)

var/old_usage = static_power_usage
Expand Down
Loading

0 comments on commit d1b8423

Please sign in to comment.