Commit Graph

88 Commits

Author SHA1 Message Date
Atermonera
77fef98789 Merge pull request #7010 from atlantiscze/2020_04_17_LoadBalancing
Ports over power-related enhancements and tweaks i coded for Bay a while back
2020-05-03 18:45:25 -04:00
Leshana
763753648b Implements "static" area machinery power usage
- Instead of using auto_use_power to re-tally up machinery's power usage every cycle, track the steady "static" load separately from the transient "oneoff" usage.  Machines then only need to inform the area when they use oneoff power or *change* their steady usage.
- Remove auto_use_power and stop SSmachines from calling it.
- Add vars to track "static" usage for each of the three power channels to /area
- Rename the existing three vars to "oneoff" so its clear what they mean (and to catch people accidentally updating them directly)
- Update area power procs and APCs to use the new variables.
- Rename /area/proc/use_power() to use_power_oneoff() to make it clear what it is doing.
- Deprecate /obj/machinery/use_power() in favor of use_power_oneoff() but don't delete yet.  Can transition gradually.
- Add logic to the update_power procs on machines to calculate the deltas and update static area power whenever their usage changes.
- Add logic to machines to update area power when they are created, destroyed, or move.
- Moved /obj/machinery procs related to area power usage into machinery_power.dm to make them easier to find.
- Added or updated comments in several places to explain what is going on and how to use it.
2020-04-23 19:04:34 -04:00
Atermonera
cbb40196fc Machinery: Always use update_use_power() 2020-03-23 23:21:10 -04:00
Arokha Sieyes
47ccc655db Deprecate the stream operator 2020-02-12 19:38:43 -05:00
Neerti
3aca2c38e2 Yet Another Circuit Update (#5549)
* Circuit updates, adds new components, improves printer, new assemblies.

* Finishes powernet circuit.

* Adds wearable assemblies.

* Finialization before merging with GLOB port.

* Finishes circuit update, hopefully.

* Forgot to undo map.

* Removes debug output.
2018-09-12 20:51:32 -05:00
Anewbe
7f84aeab9f Merge branch 'master' of https://github.com/PolarisSS13/Polaris into is_tool 2018-08-02 22:35:14 -05:00
Leshana
db0ba60f64 Implements the Tesla engine and supporting features (#4539)
* Adds "typecache" utility functions. A fast way to filter lists by type.

Ported from TG

* Ports the "orbit" feature and subsystem from TG

* Adds a feature that allows mobs and objs to "orbit" around some atom.  They literally are moved around in circles.  See the `orbit` proc in orbit.dm.
* Adds a subsystem that processes the actual movement of orbiting items.

* Adds utility methods for common machinery behavior.

* Adds default_unfasten_wrench which handles the standard anchor/unanchor behavior of wrenches being used on machines.  Together with the other default_x_tool machinery procs we can eliminate having that code duplicated in dozens of places!
* Adds is_wire_tool proc to easily detect when a machine is hit with a tool that should open its wires UI (if it has one).

Based on ideas from Paradise, with improvements for us.

* Implements the Tesla Engine

Ported from a mixture of TG and Paradise code and assets: Edison's Bane

Includes the tesla energy ball itself, the generator that makes it, tesla coils, grounding rods, the circuits and frames to build them.

* Switch dusting to zapping on impact and spin better

Ported /tg SpinAnimation which supports more than triangles.
2018-01-19 14:56:08 -06:00
Leshana
a1734c97e9 Moved makepowernets() into SSmachines initialization proc. 2017-12-29 15:32:06 -05:00
Leshana
e48b548f2b More and more Destroy() cleanups all across the board - Return qdel hints. 2017-06-05 23:01:41 -04:00
comma
5f2d23fbd7 Makes cable use BYOND directions
Instead of 11,12 they use 32,16 for DOWN,UP
Merges multiz handling into main logic
Port of: https://github.com/Baystation12/Baystation12/pull/15907
2017-04-21 11:22:07 -04:00
Anewbe
0418911e0b Robots should not be shocked by wires/machines 2016-11-12 21:35:55 -06:00
Neerti
bb489cb09f Adds the new Grid Check event to rotation.
Maps in a new Grid Checker machine, located in an expanded substation room in Engineering.  When a grid check happens, Engineering can hack that machine to restore power sooner.  Wearing insulated gloves is highly recommended.
2016-10-21 12:47:57 -04:00
Neerti
337ef499a1 Cleans Up WIP Event System + New Grid Check For It
Separates the 'count and assess everything' stuff to it's own datum, called the metric datum, which I plan to add on to in the future to make counting and metrics easier.
Makes decision process a bit more weight-based, will probably continue tweaking later.
Makes the admin debug UI have links to change settings easily.
Adds replacement for grid check event, which works similar to the old one, but is now based on a physical machine in the game world, that Engineering can hack to make the event end faster, if so desired.  Note that the machine is not mapped in, and won't be mapped in until the event system is ready for launch.
Adds grid_check variables to SMESes and APCs to make them stop doing work without draining the battery.
Grid checks in the new system are caused by a "power spike" which originates from the engine and will cause bad things, should no grid checker machine be connected to the power-net.  These power spikes occur when the GM decides that a grid check is a good event to have.
The grid checker can be built and deconstructed using the standard machine construction methods.
2016-10-05 21:40:07 -04:00
Zuhayr
6edb8b31f3 Made slimes more interesting. 2016-05-06 04:07:52 +09:30
Zuhayr
3b712adb5f Removed intact var in favour of is_plating() proc, fixed issues with invisible initialized pipes. 2015-08-16 17:51:19 -07:00
Atlantis
8a5a969002 More Destroy()s, better implementation
- Re-implements Destroy() for SMES units. This time moves relevant (de)construction code all the way up to obj/machinery/. This should fix any potential GC issues with deconstruction of component-based machines.
- Implements Destroy() for breaker boxes.
- Fixes SMES units lacking disconnect_terminal(), causing GC errors.
2015-06-06 11:04:41 +02:00
PsiOmega
e74c0e65bf Merge remote-tracking branch 'upstream/master' into dev-freeze
Conflicts:
	code/game/objects/items/weapons/power_cells.dm
2015-05-22 08:26:13 +02:00
mwerezak
defc4c1f94 Adds check_charge(), checked_use() 2015-05-18 20:09:09 -04:00
Mloc
e602a7e286 remove the sub-area system
Removes area/list/related and area/master.
They were only used by the old lighting subarea system.

Signed-off-by: Mloc <colmohici@gmail.com>
2015-05-10 17:06:29 +01:00
PsiOmega
1ae0ad6d92 Updates the atom_pool, now datum_pool, to handle any datum object.
Makes the garbage collector similarly robust. Continues the whole Destroy/qdel porting.
2015-04-24 09:59:05 +02:00
mwerezak
b7e3a14e0d Fixes machines being usable after a power failure
Fixes machines not gaining the NOPOWER flag after a power failure
because they were turned off and had use_power set to 0.
Fixes machines not gaining the NOPOWER flag after being moved into an
area with no power.

Both bugs allowed power using machines to be used in areas with no
power.
2015-02-11 23:28:53 -05:00
GinjaNinja32
c97b54fe56 Fixes power runtime 2015-01-22 15:03:54 +00:00
Atlantiscze
6bd47590cd Warning System Fix
- This fixes bugged powernet warning system. Electrocution now properly triggers warning even when short-circuit is caused by gloved user
- However, there is small difference. Causing sparks but not taking damage triggers only 5 tick warning, instead of 20 tick one. 20 tick warning is triggered when injury is caused.
2015-01-01 06:00:05 +01:00
Atlantiscze
90a83c19cf Hardsuit powersink module now uses CELLRATE properly
- Adds CELLRATE (and SMESRATE for SMESs) into drain_power proc.
- Adds "amount" parameter to drain power proc, sets the powersink module to 40kW draw (80 cell charge/s), which should correspond with normal cell recharger.
- Removes drain_power from all machinery, and adds drain_power to machinery/power. This means you can only drain from machines that have something to do with wiring or electricity.
2014-12-29 20:40:57 +01:00
Zuhayr
505d84049c Properly implements the species insulated var (renames it to siemens_coefficient), includes it in electrocution, rebalances species values accordingly. 2014-12-28 19:16:07 +10:30
PsiOmega
955b64e0a5 Merge remote-tracking branch 'upstream/dev' into APC. Updates map with new SMES variable names. 2014-11-03 12:51:01 +01:00
PsiOmega
a1c19b78be Ports more of /tg/'s powernet code.
Among other things this fixes a a bug where SMES would draw excess power from the powergrid they were outputting to, rather than drawing from.
2014-10-29 14:01:35 +01:00
PsiOmega
3a7066c6c1 Replaces add_load with draw_power. Issue about silly battery handling remains. Fixes the build-error. 2014-10-20 19:18:27 +02:00
PsiOmega
a1ee4e766b Basically ripped over /tg/'s powernet and cable code into our own codebase.
Keeps Z-level code as it was.
Modifies/restores powernet procs as necessary to match our own implementation changes.
2014-10-13 17:13:04 +02:00
PsiOmega
36c9f65bb1 Ports /tg's cable and powernet code to our code base. 2014-10-10 14:59:44 +02:00
Zuhayr
223bd86f18 Merge branch 'organremoval' of https://github.com/Zuhayr/Baystation12 into dev
First pass on major conversion of xenomorphs to a human subspecies. Additional condensing of various redundant mob verbs.
Converted larva and diona to their own class, collapsed the rest of xenomorphs into a human species, other stuff.
Completely removed attack_alien(). Still have to reimplement some of the lost behavior for human/alien.
Reapplies lost attack_alien() functionality other than tackling/caressing.
Further alien/humanoid cleanup and xenospawn fix-ups. Also uncommented caste verbs.
Removed half-finished abilities system since species.dm handles it.
All xenomorphs functionality should be working now, other than the HUD, tackling and the xenomorph balance issues.
Added icons for xenomorph castes, moved broadcast languages into datums, removed alien_talk and robot_talk vars.
Merged with organ removal code.
Reapplied verbs to simple_animals/slimes. Updated species definitions to have appropriate organs.
Readded tackle as a human verb.
Borer changes regarding brain removal.
Working on moving the human HUD to the species datum a bit. Mixed results.
Moved Cortical Link to a language, added borer husks.
Tidied up the HUD stuff. Still need to make it rebuild properly when species is changed, but this will do for no
Compile fix, forgot the DME.
Fixed up ventcrawl, added new organ mechanics for dionaea.
Fixed up some overlooked sections causing mobs without brains to die immediately.
Fixed up plasma generation for queens, bugs with organs, force_organ issues with set_species().
2014-09-29 06:19:26 +09:30
Chinsky
69ed2317bf Merge pull request #6428 from atlantiscze/cyborg-power
Cyborg power overhaul
2014-09-25 00:19:13 +04:00
Atlantiscze
5b905ebde1 Cyborg Advanced Charging
- This solves various issues with cyborg charging
- Cyborg chargers have 15k charge capacity themselves. They charge at 2.5kW when no cyborg is inside and 25kW when cyborg is inside.
- Instead of draining power directly to cyborg's cell, they simply transfer power (capped at 250 charge/tick) from charger to cyborg.
- All is checked, which means no excess power is wasted. This means AFK cyborgs parked in rechargers are no longer power sinks

Balance
- Increased cyborg actuator power usage a bit.
2014-09-17 08:59:19 +02:00
mwerezak
d12a09addb Powernets
Moved powernet datum definition to powernet.dm
Improved APC load balancing.
Updated SMES charging to work better with new APC/powernet code.
2014-09-07 01:10:22 -04:00
Atlantiscze
20d33815ba Breaker Box Fix
- Removes source of runtime errors. From my examination of code, it seems these errors happen when breaker box is turned off for the first time. It should work then.
- Mostly temporary fix, i intend to rework the powernet code over time. I would welcome cooperation with @mwerezak as he is currently doing lots of related things.
2014-09-02 17:09:37 +02:00
mwerezak
304d88a4d4 Adds simple load balancing 2014-08-21 19:27:12 -04:00
mwerezak
f2b234fe81 Fixes APCs drawing more power than they can to use to charge 2014-08-21 01:18:26 -04:00
Zuhayr
f09d1218fe Master to dev merge. 2014-08-11 17:23:40 +09:30
mwerezak
e1dc7d436b Fixes icons and other things not updating when the master controller updates power status.
This was due to the master controller using update_powered_status()
instead of power_change(), but many machines override power_change() to
do various things when the machine gains or loses power.
2014-08-10 03:45:20 -04:00
mwerezak
4b070a2de6 Fixes #5935
Also improves apc/process() (doesnt add and then remove charge from
cells when it doesn't have to).
2014-08-10 03:44:56 -04:00
mwerezak
b529d582e5 Fixes siemens_coefficent not affecting shock damage
Also cleans up electrocute_act()
2014-07-31 15:20:45 -04:00
mwerezak
bf0a17dcb0 Fixes NOPOWER not updating when machines are moved 2014-07-28 18:52:13 -04:00
mwerezak
cd1ed034a8 Adds power net profiling verbs 2014-07-27 19:59:02 -04:00
mwerezak
cb413454a3 Optimizes atmos machine power updates
Makes power usage but atmos machinery less accurate but reduces lag
somewhat.
2014-07-27 03:35:25 -04:00
Ccomp5950
fb04a88774 Removed my debug lines. 2014-03-08 03:55:22 -06:00
Ccomp5950
e0e1bd9cfb APC Area update initial commit. 2014-03-07 23:42:28 -06:00
Zuhayr
e870d614c2 Mass correction of controler to controller. 2014-01-25 03:15:13 +10:30
LBraindead
4bccee98ba Update power.dm
powernet connection for z-levels
2014-01-18 00:20:22 +01:00
Mloc-Argent
33805e639b Implements hooks, an easier way to write code to be called at startup/roundstart/roundend.
Current hooks are "startup", "roundstart", and "roundend".
Most stuff in world/New() has been moved over to the startup hook.
Roundstart and roundend have no hooks yet.

Removed the unused "newbanjob.dm" file and associated verbs/topics.
Bumped RECOMMENDED_VERSION up to 501.

Signed-off-by: Mloc-Argent <colmohici@gmail.com>
2013-11-25 21:16:09 +00:00
Uristqwerty
b1c20c32d7 Fixed infinite loop in powernet rebuild.
If a /obj/machinery/power wasn't anchored, it wouldn't get a new list of connections, so would endlessly loop on the old list, of which that object was the first entry, ensuring that the loop would never terminate.
2013-02-20 14:47:32 -05:00