-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite bionic fuel system. #60662
Closed
Closed
Rewrite bionic fuel system. #60662
Conversation
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
github-actions
bot
added
[Python]
Code made in Python
Appliance/Power Grid
Anything to do with appliances and power grid
Character / World Generation
Issues and enhancements concerning stages of creating a character or a world
Code: Tooling
Tooling that is not part of the main game but is part of the repo.
Crafting / Construction / Recipes
Includes: Uncrafting / Disassembling
EOC: Effects On Condition
Anything concerning Effects On Condition
Fields / Furniture / Terrain / Traps
Objects that are part of the map or its features.
Game: Achievements / Conducts / Scores
Player goals and how they are tracked.
Items: Ammo / Guns
Ammunition for all kinds of weapons and these weapons themselves
Items: Archery
Bows, crossbows, arrows, bolts
Items: Armor / Clothing
Armor and clothing
Map / Mapgen
Overmap, Mapgen, Map extras, Map display
Melee
Melee weapons, tactics, techniques, reach attack
Missions
Quests and missions
Mods: Aftershock
Anything to do with the Aftershock mod
Mods: Desert Region
Anything relating to the Desert Region mod
Mods: Dinomod
Anything to do with the Dinoclysm mod (DinoMod)
Mods: Generic Guns
Anything to do with Generic Guns
Mods: Innawood 🌲
Anything to do with Innawood mod
Mods: No Hope
Relating to the mod No Hope
Monsters
Monsters both friendly and unfriendly.
NPC / Factions
NPCs, AI, Speech, Factions, Ownership
SDL: Tiles / Sound
Tiles visual interface and sounds.
Spawn
Creatures, items, vehicles, locations appearing on map
Translation
I18n
labels
Sep 16, 2022
Uh oh. I completely messed up the branch. I'll make a new pull request from copy of the non-messed branch. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Appliance/Power Grid
Anything to do with appliances and power grid
astyled
astyled PR, label is assigned by github actions
BasicBuildPassed
This PR builds correctly, label assigned by github actions
Bionics
CBM (Compact Bionic Modules)
[C++]
Changes (can be) made in C++. Previously named `Code`
Character / World Generation
Issues and enhancements concerning stages of creating a character or a world
Code: Tests
Measurement, self-control, statistics, balancing.
Code: Tooling
Tooling that is not part of the main game but is part of the repo.
Crafting / Construction / Recipes
Includes: Uncrafting / Disassembling
<Documentation>
Design documents, internal info, guides and help.
EOC: Effects On Condition
Anything concerning Effects On Condition
Fields / Furniture / Terrain / Traps
Objects that are part of the map or its features.
Game: Achievements / Conducts / Scores
Player goals and how they are tracked.
Info / User Interface
Game - player communication, menus, etc.
Items: Ammo / Guns
Ammunition for all kinds of weapons and these weapons themselves
Items: Archery
Bows, crossbows, arrows, bolts
Items: Armor / Clothing
Armor and clothing
Items: Containers
Things that hold other things
[JSON]
Changes (can be) made in JSON
json-styled
JSON lint passed, label assigned by github actions
Map / Mapgen
Overmap, Mapgen, Map extras, Map display
[Markdown]
Markdown issues and PRs
Melee
Melee weapons, tactics, techniques, reach attack
Missions
Quests and missions
Mods: Aftershock
Anything to do with the Aftershock mod
Mods: Desert Region
Anything relating to the Desert Region mod
Mods: Dinomod
Anything to do with the Dinoclysm mod (DinoMod)
Mods: Generic Guns
Anything to do with Generic Guns
Mods: Innawood 🌲
Anything to do with Innawood mod
Mods: Magiclysm
Anything to do with the Magiclysm mod
Mods: No Hope
Relating to the mod No Hope
Mods: Xedra Evolved
Anything to do with Xedra Evolved
Mods
Issues related to mods or modding
Monsters
Monsters both friendly and unfriendly.
NPC / Factions
NPCs, AI, Speech, Factions, Ownership
[Python]
Code made in Python
SDL: Tiles / Sound
Tiles visual interface and sounds.
Spawn
Creatures, items, vehicles, locations appearing on map
Translation
I18n
Vehicles
Vehicles, parts, mechanics & interactions
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.
Summary
Content "Rewrite bionic fuel system."
Purpose of change
Bionic fuel system currently works by saving {"material_id", "quantity"} pairs as variables into player data when player eats fuel for the bionics. (Yes the fuel is still handled as being eaten!)
This is not a good way to do it. The biggest problem is that it uses material energy attribute wrong. The material energy is in energy per volume. But there is no volume info available.
To use material energy attribute correctly the bionic system must work with items.
Describe the solution
Bionic fuel exists as items.
It was supposed to be simple to switch where bionics look for their fuel. But it turns out that the bionic code was very "side effect oriented". One function would set the fuels in player variables then another function would read the fuels from player variables. Instead of trying to refactor that mess I ended up rewriting everything...
All items with
"BIONIC_FUEL_SOURCE"
will have their contents available as fuel for fuel powered bionics.Fuel powered bionics now install pseudo item container for the fuel. This container is visible in worn equipment window.
Player refuels the bionic by placing fuel into the appropriate fuel tank pseudo item.
Added ability to limit pocket contents by item material. So you can only put items made out of gasoline into gasoline tank.
Battery system bionic can use medium and light batteries. This does lower its max stored charges a bit (used to be 2000 which is about same as heavy batteries). But the more convenient reload action should compensate.
Also simplified the autostart and fuel saving systems.
Autostart system has been removed. (it used to turn fueled bionic on if power level was below treshold).
Reworked fuel saving (it used to turn fueled bionic off if power was above treshold).
Now the bionic will simply not consume any fuel unless power is below the treshold.
Fuel powered bionics will behave as if they were "off" if power is above treshold. (muscle bionics slow you down less when off).
Bionic that is "ON" but not active due to fuel saving will show "(inactive)" in the bionic menu.
Bionic tanks visible in inventory. You can insert/remove items to/from them just like any other container:
Bionic window is basically the same as before:
Known issue: NPCs do not refill their bionic tanks. NPCs do not reload their magazines either and I do not really know enough about the NPC code to quickly fix.
Probably best behavior would be to every now and then when out of combat see if any container with
"BIONIC_FUEL_SOURCE"
flag can be refilled and refill them.Describe alternatives you've considered
Testing
Gasoline fuel cell works (8 kJ/s).
Oil generator works (9 kJ/5s).
Cable charger works when connected to UPS, solar backpack and vehicle.
Fuel can be reloaded and unloaded.
Running out of fuel turns bionic off.
Saving and loading works.
Loading old saves migrates properly. Even the charges are migrated!
Additional context