mt-mods / mt-mods/technic

Cleanup useless battery box metadata

Open
#401 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Cleanup Performance
Dominant language
Lua
Stars
23
Forks
33
PR merge metrics
No merged PRs in 30d

Description

Some cleanup was done a moment ago:

  • #126

Adding this new issue for leftovers to keep things easier to follow.

It would be possible to remove all metadata from batteries and only store values for charge and max_charge at network level.

However that would make it impossible to detach battery from network by digging cable that connects it to network and also destroying network data would either reset batteries or would require complex handling for batteries, I think having metadata for that is good so maybe not remove that (internal_EU_charge).

Next changes for battery handling

Batteries are not functional when not attached to network which means that *_EU_supply and *_EU_demand meta data values for batteries could be removed completely. Possibly also internal_EU_charge_max. Those are still there but not used that much after last PR #126

This requires always balancing charge level between batteries attached to network, it is done already to some degree but is bit buggy. Take battery upgrades into account as those allow having different maximum capacity for batteries, therefore it would be best to allow battery to set actual charge values and only inform batteries about network charge level as percentage value. That would also fix current glitches with having 1000kEU max charge battery with 1200kEU actual charge.

Originally posted by @S-S-X in #108

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests; start by reviewing the prior cleanup in #126 and tracing the existing battery and network charge handling. Done means unused battery metadata is removed where appropriate, charge balancing accounts for battery upgrades, and the described capacity mismatch and network-detachment behavior remain correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
game-dev
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.