Sustainability & Scalable explosives & Small clean up changes#266
Draft
KemGus wants to merge 15 commits into
Draft
Sustainability & Scalable explosives & Small clean up changes#266KemGus wants to merge 15 commits into
KemGus wants to merge 15 commits into
Conversation
Adds a sustainability sandbox layer: voltage/transformer grid model, physical power lines, fuel pipes/pumps, oil pump + refinery + synth, batteries with heat/wear, solar, alternator, capacitors, power collector/consumer, breakers, and the ACE Conduit tool. Pure-logic modules under sustainability/. Also bundles pre-existing working-tree edits (sensors, E2/SF ACF cores, opticalcomputer). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
On a 6-station full mesh that's ~120+ paths per search, run by every station every tick, each branch allocating a throwaway path table -> CPU spike + GC thrash -> 1 FPS -> crash The fix - replaced the previous search with a new search that settles every node exactly once
Sun data was taken from clients via an ace_sun_sync net message and cached server-wide, letting any client spoof sun direction/brightness every tick and grief solar output. Read the map sun SERVER-SIDE instead (env_sun sun_dir + light_environment luminance), the way wiremod E2 sunDirection() does; drop the net message, the client timer, and the never-consumed SunObstruction. Convar-sun fallback unchanged. Also clear all glualint warnings the sustainability update introduced: unused Player/Id/Type params -> underscore-prefixed, unused cfg callback args, dead resK local, solar comment indentation, combined double-if in PipeFindSupply, and an operator-spacing fix in acf_globals. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Grid menu-links were a purely logical graph edge whose distance was only checked at link time, so dragging a node away kept the link working forever - unlike ACF drivetrain links, which snap when pulled past 1.5x their length. And the drawn beam used cable/rope, implying a physical cable that then never broke. - New Sustain.PruneStretchedLinks() unlinks (both ways, via the entity's own Unlink) any neighbour dragged past range * ACF.LinkStretchMul (1.5), with an owner chat notice. Called each Think in transfer_station, transformer, capacitor and power_line. - Power consumer: snap its grid tap when stretched, and add the creation-time distance check it was missing. Local battery link left alone. - Link beam material cable/rope -> cable/cable2 to match ACF drivetrain ropes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
They initialized self.Active = true and only changed it via TriggerInput, so an unwired Active input read 0 on the wire HUD while the entity stayed on - looked like "works even when Active is 0". Default them to off (wire Active to 1 to run) and add an "Active: ON/OFF" overlay line so a spawned-but-idle generator says why. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A power line was only LIVE if it could reach a source within ACF.GridMaxHops (10), and each wire segment is one hop - so a long straight run went dead past ~11 segments. That hard cutoff isn't realistic (real lines are limited by voltage drop / ampacity, both already modelled), it was just a search safeguard. - gridFindSources: traversing a relay (transformer, or relay-mode station) now RESETS the hop budget, so it acts as a repeater that extends the run - maxHops now bounds one relay-to-relay segment instead of the whole line. - ACF.GridMaxHops 10 -> 20 so a single run isn't so tight; it's now a safety net, not the real range limit. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Merit order (gridFindSources): sources now sort by tier first, then efficiency. Real generation/storage is tier 0 and is fully used before any buffer. The capacitor reports GridSourcePriority() = 1, so a load only touches it for the shortfall. Gentle recharge (ace_capacitor Think): refills at MaxRate × 0.2 (new ACF.CapacitorRechargeMul), discharge stays full-rate. it saturated line, created free electricity out of thin air. Conduit tool now creates better auxiliary links. should be more helpful to debug issues and just for constructing in general.
KemGus
marked this pull request as draft
June 3, 2026 08:50
Electrical rework on the sustainability grid: - Path-based voltage solver (logic_gridsolve): conductors carry the source/transformer voltage, re-referenced at relays; offline relays (incl. the entry node) no longer conduct. - Over-voltage overheat/damage on electric loads; real-time power draw on the oil pump and fuel synth; loads tap the grid directly. - Over-current-only short model; lossy power lines now dissipate their loss as heat. - Grid tool: end-to-end stacking with frozen segments, lay cooldown, flow animation on grid and battery links. - Power entities (transformer/consumer/capacitor/collector/burner) spawn OFF; deferred battery relink on dupe paste. - Player-friendly menu descriptions; battery charge-headroom model so a sink can't drain the grid into a battery that can't store it. - Pure-logic test harness (tests/, run with luajit). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Fuel synth cook-off called ACF_ScaledExplosion, which only understands ammo crates (BulletData) and acf_fueltank - on a synth it nil-errored, so an overpressured reactor froze instead of exploding. It now detonates directly (like ace_explosive): blast sized as a same-size full fuel tank via the tanks' litres->HE rule, capped at ScaledHEMax. - Documented who does what: role map of every sustainability entity in sh_sustain.lua plus identity headers on the commonly-confused fuel entities (synth makes fuel from electricity, burner only destroys it, refinery needs crude, "field generator" is an oil pump not a power generator). - Explosive charge max size halved (250 -> 125 via def MaxSize): menu sliders and server-side ParseScale both clamp, so edited dupes can't smuggle in nukes. - Refinery dupe restore dropped links after any missing one (ipairs over a nil-holed array); now keyed. - Removed the dev-only luajit test harness from the repo (38/38 passing at removal). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The class was named "field generator" while being a crude-oil pump that CONSUMES electricity - the single most confusing name in the fuel chain. Renamed end to end since the branch isn't deployed anywhere: entity dir, Make/Define/GUI functions, ACF.Weapons.OilPumps def table, ACF.OilPump* config globals, sbox limit convar, and every whitelist (contraption, E2, Starfall, conduit tool, pipe/pump links). Old dupes of the entity won't restore; nothing is on prod. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The rename pass accidentally rewrote these two CRLF files as LF, turning a few-line change into whole-file churn against upstream. Content is unchanged from the previous commit. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The scalable + prebuilt explosive charges are split into a self-contained branch (scalable-explosives, off dev) so this PR is sustainability-only. Removes the explosive entities (ace_explosive, ace_explosive_prebuilt, ace_bomb_satchel / ace_bomb_aerial / ace_bomb_barrel), their def file, and the explosive-only registration: the loader's Explosives table / ACE_DefineExplosive / "explosives" def folder, the ACF-menu tree node + ACEExplosiveGUICreate, the category-map and contraption-allow-list entries, the spawn-limit convar, and the ACF.Explosive* config globals. The shared scalable-entity framework the sustainability ents also use (BuildScalableConfig, Sustain.ParseScale/ApplyShape/FinishSpawn, ACF.SustainMinimumSize, logic_scale) stays. Also drops the now-dangling ace_explosive mentions from the sh_sustain role map and the synth cook-off note. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Idea: sustainability was a great vision of what ACE could be, a more general focused addon that would let you unfold your creativity even further (hence why slogan "Build beyond limits"). There was no point before of making a base or some logistics center (I see you Kettengrad). The "Refuel" part was always boring and simply could have some improvements. With these changes you may now create your own grid for trams or trains, power up your base, give your car battery a second go, mine oil (USA POWER). The entire point is to let you CREATE more. Also same thing with scalable explosives and their entity counterparts. Well, good ol' drones or custom mines or custom missiles or anything custom is now real.
Summary: brings in electricity, oil, scalable explosions & more integration with menu (ecm, rwr). And a new tool called ACE Conduit
Brings:
Alternator - creates resistance on the spinning prop. Literally gearbox that is always breaking and creates electricity because of that.
Solar panel - scalable panel, considers how "dark" it is on the map and sun position (env.sun)
Transfer station - Node of the electric grid. "Converts" AC to DC and sets the line voltage.
Transformer - AC line voltage control.
Power line - your good ol' wire, has its own resistance, scalability and such.
Power consumers - you can now "mimic" the electricity inside any of your contraption, feel free to make electricity real now, your car radio now pulls electricity if you want to.
Capacitor - help with sudden demands
Power breaker - fuse like system to protect devices, stations.
Power collector - trams and trains are now possible, they will feed from the wire hanging above them.
Fuel synthesizer - convers electricity into fuel. very inefficient, but good for start.
Oil pump. - pump oil, collect it and convert into fuel.
Fuel plug& socket. well now you can choose which exact tank you're going to fill up. welcome the gas stations.
Fuel pipe - scalable pipe. has its own flow rate. has a condition which means when it breaks it no longer functions and leaks.
Fuel pump. - help to transfer oil faster.
Refinery - convert oil into diesel or petrol.
As for entities that is it, there are certainly other stuff to talk about.
Supplemented E2 / SF functions (requires proper testing).
Moved ECM & RWR & Optical computers in the menu categoiries. Now everything is in its right place.
Universal fuel tank. Well now you can fill it up with whatever you want. Assigns its class upon filling up, so if you filled it up with petrol it becomes petrol. when empty it is universal once again. Welcome fuel transfers.
Spawn empty logic - now users through client settings decide whether they want their fuel tanks to spawn empty or not. Also serverside setting included for harsh logistics environment. fill your tank up before you go moment.
Also a setting to draw ACE grid beams clietnside.
Added more inputs and outputs to battery and fuel, you can now see the battery cycles information.
Now battery filling up is faster all the way to 80% and then it slows down.
Balance changes to existing constants
ElecRate4 → 0.8 (electric motors were drawing ~5× their mechanical output).Notes for reviewers
devresolved an unrelated armor/points conflict(!!!!!!!) insh_ace_functions.luain favor ofdev(kept consistent with dev'ssv_pointshandling). Sustainability code was untouched by that resolution.Also linking in old video (with some of the stuff being broken) but you can see some functionality there.
https://www.youtube.com/watch?v=i7ZRQI9CHoQ