mt-mods / mt-mods/technic

Fix machine to power cable connections

Open
#124 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Problem:

Network does not care if power cable is actually connected or not by connect_sides rules.

Fix it:

To fix this there should be connection matrix calculated using connect_sides rules and that should be then checked when machine is about to be attached to actual network.

For example, based on this information:
https://github.com/mt-mods/technic/blob/c58673f2af88dc5c6a4df03443415cdbfa97392a/technic/machines/register/generator.lua#L126
Something like this should be added as rules
(not sure if this follows convention how engine gives directions but similar to this at least):

{
  {x= 0, y=-1, z= 0}, -- Bottom
  {x= 0, y= 0, z= 1}, -- Back
  {x=-1, y= 0, z= 0}, -- Left
  {x= 1, y= 0, z= 0}, -- Right
}

IMO this can be implemented at first by allowing just rotation around y but all possible rotations would be nice, I bet there's tested and working copy/paste code for that somewhere...
However I think that engine also does not always handle rotation correctly with connect_sides so very simple y axle rotation would be fine too.

Where to?

Check should be added here: https://github.com/mt-mods/technic/blob/c58673f2af88dc5c6a4df03443415cdbfa97392a/technic/machines/network.lua#L199-L217
And possibly also here: https://github.com/mt-mods/technic/blob/c58673f2af88dc5c6a4df03443415cdbfa97392a/technic/machines/register/cables.lua#L23-L52

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

Start with the connect_sides rules in technic/machines/register/generator.lua, then inspect the network attachment logic in technic/machines/network.lua around lines 199-217 and the cable registration in technic/machines/register/cables.lua. Determine the supported rotation behavior and verify that machines attach only when the power cable direction matches the connection rules.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.