Skip to content
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

Fix cable plate placing on several-blocks nodes #358

Merged
merged 6 commits into from
Apr 14, 2024
Merged

Conversation

Athozus
Copy link
Member

@Athozus Athozus commented Apr 1, 2024

The description is not very well because it's hard to describe what I've done in a single, notably in English. I can force-push to a better commit message if needed. EDIT : I think the title describe better the changes now.

What I've done :

  • I noticed by debugging with minetest.chat_send_all that the index value was exceeding the range of #xyz, so it caused nil index in fine_pointed call.
  • So I just add "brought back" the index value within the range of 3 divisors. Lua starts numbering at 1, so it does that weird (index-1)%3+1

Fix #305

@Athozus Athozus added the Bug fix label Apr 1, 2024
@Athozus Athozus added this to the 2.0.0 milestone Apr 1, 2024
@Athozus Athozus changed the title Use modulo to bring back index > 3 within {x,y,z} range Fix cable plate placing on several-blocks nodes Apr 1, 2024
@S-S-X
Copy link
Member

S-S-X commented Apr 1, 2024

edit. never mind, you changed this already and those tests are passing.

However, does it need other than normalization of fine_pointed vector (or pointed_thing.above)? That would be cleaner as there's vector.normalize(v). And should deliver exact same results.

@Athozus
Copy link
Member Author

Athozus commented Apr 1, 2024

However, does it need other than normalization of fine_pointed vector (or pointed_thing.above)? That would be cleaner as there's vector.normalize(v). And should deliver exact same results.

index is a number, so I don't understand why vector.normalize() should be used. Note that fine_pointed is constituted of nil values, not 0 (like I except from the function, according to the documentation).

@S-S-X
Copy link
Member

S-S-X commented Apr 1, 2024

index is a number, so I don't understand why vector.normalize() should be used. Note that fine_pointed is constituted of nil values, not 0 (like I except from the function, according to the documentation).

Basically what you're doing is normalization afterwards. Normalizing beforehand is just another way to do the same.
Reason why I'm suggesting vector.normalize is that it would be kinda self explaining and cleaner in code.

But I guess, whether going with current way for normalization or using vector.normalize, it probably would be good to also add comment that explains corner case why it has to be normalized.

@S-S-X
Copy link
Member

S-S-X commented Apr 2, 2024

Did read whole thing again and to handle all cases wouldn't it be required to normalize way before current solution, on line 99:

local pointed_thing_diff = vector.subtract(pointed_thing.above, pointed_thing.under)

Change to

local pointed_thing_diff = vector.subtract(pointed_thing.above, pointed_thing.under):normalize()

Wouldn't that make sure it is handled in all possible corner cases, make it bit more cleaner / understandable and also shorter?

edit. Actually there's even better shorthand method for it (documented since 5.0.0):

local pointed_thing_diff = vector.direction(pointed_thing.above, pointed_thing.under)

fine_pointed still needs the same. I think going from vector.subtract to vector.direction should work fine there as well.

@Athozus
Copy link
Member Author

Athozus commented Apr 5, 2024

Actually there's even better shorthand method for it (documented since 5.0.0):

local pointed_thing_diff = vector.direction(pointed_thing.above, pointed_thing.under)

fine_pointed still needs the same. I think going from vector.subtract to vector.direction should work fine there as well.

Replacing subtract by direction causes strange behaviours. Notably different results while pressing Sneak or not pressing it on « normal » blocks.

@S-S-X
Copy link
Member

S-S-X commented Apr 6, 2024

Replacing subtract by direction causes strange behaviours. Notably different results while pressing Sneak or not pressing it on « normal » blocks.

Checked this, try with:

local pointed_thing_diff = vector.direction(pointed_thing.under, pointed_thing.above)

and

fine_pointed = vector.direction(pointed_thing.above, fine_pointed)

Notice that I've swapped arguments.

I'm not sure however if this is correct or not, didn't really think it through and it is likely that directions have been messed up either since beginning or since I've rewritten this thing for cable plate placement.

@Athozus
Copy link
Member Author

Athozus commented Apr 6, 2024

Replacing subtract by direction causes strange behaviours. Notably different results while pressing Sneak or not pressing it on « normal » blocks.

Checked this, try with:

local pointed_thing_diff = vector.direction(pointed_thing.under, pointed_thing.above)

and

fine_pointed = vector.direction(pointed_thing.above, fine_pointed)

Notice that I've swapped arguments.

I'm not sure however if this is correct or not, didn't really think it through and it is likely that directions have been messed up either since beginning or since I've rewritten this thing for cable plate placement.

Still not very precise. I'm currently decomposing the algorithm because I think it can be 50% shorter.

EDIT : My bad, the fix was working ; I had just changed some things while debugging. However, I still think that it could be shorter.

@Athozus
Copy link
Member Author

Athozus commented Apr 6, 2024

Imho that could be something like this :

local pointed_thing_diff = vector.direction(pointed_thing.under, pointed_thing.above)
local dir = math.abs(pointed_thing_diff.x + 2*pointed_thing_diff.y + 3*pointed_thing_diff.z) -- 1, 2 or 3
local num = dir + 3/2*(1-pointed_thing_diff[dir]) -- dir + additional negative offset

local node = {name = nodename.."_"..(num ~= 0 and num or 1)}
return item_place_override_node(itemstack, placer, pointed_thing, node)

EDIT : It works without Sneak, it doesn't with. 👺
EDIT 2 : I made a very silly error, it should work everywhere now.
EDIT 3 : So using Sneak can returns float coordinates. Interesting......

@S-S-X
Copy link
Member

S-S-X commented Apr 6, 2024

EDIT 3 : So using Sneak can returns float coordinates. Interesting......

minetest.pointed_thing_to_face_pos is what returns float that points exact relative position on pointed node surface. This is used to find edges and change cable plate placement behavior (0.3 or closer to farthest node edge).
Cable plate placement is kind of overcomplicated but also allows placing in pretty much any orientation by looking at different position on node surface with sneak.

aux1 placement grid for which fine_pointed is used is like this:
image

So there's about 5 * 6 different placements around node when using aux1 and total 36 different placement options.

However, it also seems that pointed_thing can sometimes be diagonal with oversized nodes in which case resulting direction will be float even while positions are not.

Currently this does fix some placements but not all, those that this wont fix also can't be fixed with original deferred normalization (which in turn only fixes cases where aux1 is held, that is nodes with formspec or other node specific action). Normal placement, even while broken because of this, shouldn't however cause crash as it will just try to place a node that does not exist.

So I'd recommend this approach as a base as it, at least in theory, should get few things right that were wrong before but it still needs some additional work.

Not sure if we could round/floor here, it isn't really that clear where plate should be placed when pointed_thing is diagonal.

@Athozus
Copy link
Member Author

Athozus commented Apr 6, 2024

EDIT 3 : So using Sneak can returns float coordinates. Interesting......

minetest.pointed_thing_to_face_pos is what returns float that points exact relative position on pointed node surface. This is used to find edges and change cable plate placement behavior (0.3 or closer to farthest node edge). Cable plate placement is kind of overcomplicated but also allows placing in pretty much any orientation by looking at different position on node surface with sneak.

However, it also seems that pointed_thing can sometimes be diagonal with oversized nodes in which case resulting direction will be float even while positions are not.

Yes I noticed that one with some chat-debugging, so I'm with my paper (and lua_api.md) to think about a much faster solution than the usual long algorithms.

Currently this does fix some placements but not all, those that this wont fix also can't be fixed with original deferred normalization (which in turn only fixes cases where aux1 is held, that is nodes with formspec or other node specific action). Normal placement, even while broken because of this, shouldn't however cause crash as it will just try to place a node that does not exist.

So I'd recommend this approach as a base as it, at least in theory, should get few things right that were wrong before but it still needs some additional work.

Not sure if we could round/floor here, it isn't really that clear where plate should be placed when pointed_thing is diagonal.

I tested with some math.ceil and math.floor, but maybe the best solution is just to use param2 ? I don't really understand the necessarily of using 6 node registrations for the same one.

@S-S-X
Copy link
Member

S-S-X commented Apr 6, 2024

I tested with some math.ceil and mail.floor, but maybe the best solution is just to use param2 ?

param2 is very complicated, wouldn't recommend bringing that here. Nodes do not follow conventions for this.

I don't really understand the necessarily of using 6 node registrations for the same one.

Because of limitations of connected nodeboxes, those can't be rotated but are always static.

@Athozus Athozus requested a review from S-S-X April 7, 2024 11:47
@Athozus
Copy link
Member Author

Athozus commented Apr 7, 2024

@S-S-X note that it can be merged, the thing is fixed. The PR with a more simplistic determination of the pointed face would come later.

@OgelGames
Copy link
Contributor

Could maybe use a raycast to get the pointed position, that's what I used for omnidriver's pointed mode: https://github.com/OgelGames/omnidriver/blob/a7234fc27ad822e53bb8d3f7373d3651e58a3b49/modes/pointed.lua#L6-L20

@S-S-X
Copy link
Member

S-S-X commented Apr 7, 2024

it can be merged, the thing is fixed

The thing isn't fixed. The thing will crash in certain cases.

This does anyway fix some cases and prevents some crashes, but only when pointed thing under isn't diagonal to above node.

If merging this fast to fix crashes then I'd suggest adding check for diagonal pointed thing and just cancel placement before even trying to do anything. Then we could also close linked issue, atow this PR isn't really enough to close linked issue.

Could maybe use a raycast to get the pointed position, that's what I used for omnidriver's pointed mode: > https://github.com/OgelGames/omnidriver/blob/a7234fc27ad822e53bb8d3f7373d3651e58a3b49/modes/pointed.lua#L6-L20

Not sure how this is supposed to change it, placement already does ray cast and we do already have node position. What we do not have is direction in remaining few corner cases.
Do you think this could actually help somehow in obtaining wanted direction in those corner cases?

@S-S-X
Copy link
Member

S-S-X commented Apr 7, 2024

@Athozus could just use something like this to cancel action for remaining corner cases, allow at most single axis but do not care how far it is:

def.on_place = function(itemstack, placer, pointed_thing)
	count = 0
	for axis in pairs(xyz) do
		count = count + (pointed_thing.under[axis] == pointed_thing.above[axis] and 0 or 1)
		if count > 1 then
			return itemstack
		end
	end

Could maybe add comment too with link to this PR https://github.com/mt-mods/technic/pull/358

@Athozus
Copy link
Member Author

Athozus commented Apr 7, 2024

@Athozus could just use something like this to cancel action for remaining corner cases, allow at most single axis but do not care how far it is:

def.on_place = function(itemstack, placer, pointed_thing)
	count = 0
	for axis in pairs(xyz) do
		count = count + (pointed_thing.under[axis] == pointed_thing.above[axis] and 0 or 1)
		if count > 1 then
			return itemstack
		end
	end

This code works fine (I kept after that pre-condition the code I wrote upper). Maybe we should just returner the cable_plate_1 instead of avoiding it ?

Could maybe add comment too with link to this PR https://github.com/mt-mods/technic/pull/358

What do you exactly mean ? Should I add : ?

-- related to github.com/mt-mods/technic/pull/358

@S-S-X
Copy link
Member

S-S-X commented Apr 7, 2024

This code works fine (I kept after that pre-condition the code I wrote upper). Maybe we should just returner the cable_plate_1 instead of avoiding it ?

I think most correct way is to just return input stack unchanged, we do not want to start playing with item counts.

What do you exactly mean ? Should I add : ?

-- related to github.com/mt-mods/technic/pull/358

Yeah, I think that could be nice to have just above loop or somewhere near it so that reason for this check becomes more obvious. I mean count loop and return seems bit weird at first. It is true one could check git blame and find this discussion but sometimes it is better to just add comment.

Copy link

github-actions bot commented Apr 7, 2024

Mineunit failed regression tests, click for details

Regression test log for Technic CNC:


Regression test log for Technic Chests:


Regression test log for Technic:

++ Executing suite spec/api_spec.lua
E:	Loading common/fs from 5.4.1 failed, trying to use builtin
◌◌⭆ Starting test set api_spec.lua:204 ⯈ Technic API Machine use
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
◌
++ Executing suite spec/building_spec.lua
E:	Loading common/fs from 5.4.1 failed, trying to use builtin

++ Executing suite spec/hv_network_spec.lua
E:	Loading common/fs from 5.4.1 failed, trying to use builtin
⭆ Starting test set hv_network_spec.lua:11 ⯈ HV machine network
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded

++ Executing suite spec/lv_network_spec.lua
E:	Loading common/fs from 5.4.1 failed, trying to use builtin
⭆ Starting test set lv_network_spec.lua:11 ⯈ LV machine network
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded

++ Executing suite spec/network_spec.lua
E:	Loading common/fs from 5.4.1 failed, trying to use builtin

++ Executing suite spec/nodes_spec.lua
E:	Loading common/fs from 5.4.1 failed, trying to use builtin
⭆ Starting test set nodes_spec.lua:11 ⯈ Technic node placement
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
✱✱✱✱✱✱✱✱✱✱✱✱✱✱✱✱✱✱✱✱✱✱✱✱
++ Executing suite spec/supply_converter_spec.lua
E:	Loading common/fs from 5.4.1 failed, trying to use builtin
◌
++ Executing suite spec/tools_compatibility_spec.lua
E:	Loading common/fs from 5.4.1 failed, trying to use builtin
⭆ Starting test set tools_compatibility_spec.lua:11 ⯈ Technic power tool compatibility
W:	Deprecated technic.register_power_tool use. Setting max_charge for oldlegacy:powertool
W:	Deprecated technic.register_power_tool use. Setting max_charge for oldminimal:powertool
W:	Deprecated technic.register_power_tool use. Setting max_charge for oldhalfway:powertool
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Deprecated technic.register_power_tool use. Ensuring fields for oldlegacy:powertool
W:	Using metadata charge values for oldlegacy:powertool
W:	Updated legacy Technic power tool definition for oldlegacy:powertool
W:	Deprecated technic.register_power_tool use. Ensuring fields for oldminimal:powertool
W:	Using metadata charge values for oldminimal:powertool
W:	Updated legacy Technic power tool definition for oldminimal:powertool
W:	Deprecated technic.register_power_tool use. Ensuring fields for oldhalfway:powertool
W:	Mod oldhalfway seems to be aware of technic.plus but oldhalfway:powertool is still using deprecated registration, skipping meta charge compatibility.
W:	Updated legacy Technic power tool definition for oldhalfway:powertool
🢆 Running tests from tools_compatibility_spec.lua:92 ▷ Technic power tool compatibility oldlegacy:powertool can be used (minimum charge)
W:	Use of deprecated function technic.set_RE_wear with stack: oldlegacy:powertool
🢆 Running tests from tools_compatibility_spec.lua:106 ▷ Technic power tool compatibility oldlegacy:powertool can be used (minimum charge + 1)
W:	Use of deprecated function technic.set_RE_wear with stack: oldlegacy:powertool
🢆 Running tests from tools_compatibility_spec.lua:92 ▷ Technic power tool compatibility oldminimal:powertool can be used (minimum charge)
W:	Use of deprecated function technic.set_RE_wear with stack: oldminimal:powertool
🢆 Running tests from tools_compatibility_spec.lua:106 ▷ Technic power tool compatibility oldminimal:powertool can be used (minimum charge + 1)
W:	Use of deprecated function technic.set_RE_wear with stack: oldminimal:powertool

++ Executing suite spec/tools_spec.lua
E:	Loading common/fs from 5.4.1 failed, trying to use builtin
⭆ Starting test set tools_spec.lua:13 ⯈ Technic power tool
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded


195 successes / 0 failures / 24 errors / 4 pending : 87.172262 seconds

Pending → spec/api_spec.lua @ 133
Technic API Machine registration registers my_mod:my_battery
spec/api_spec.lua:133: Battery box registration does not include all fields

Pending → spec/api_spec.lua @ 190
Technic API Machine registration registers my_mod:machine_base
spec/api_spec.lua:190: Base machine registration does not include all fields

Pending → spec/api_spec.lua @ 285
Technic API internals technic.cables TBD, misleading name and should be updated
spec/api_spec.lua:285: TBD technic.cables naming and need, see technic networks data for possible options

Pending → spec/supply_converter_spec.lua @ 78
Supply converter building overloads network
spec/supply_converter_spec.lua:78: overload does not work with supply converter

Error → spec/nodes_spec.lua @ 45
Technic node placement player can place technic:lv_cable_plate_1
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 45
Technic node placement player can place technic:mv_digi_cable_plate_1
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 45
Technic node placement player can place technic:hv_digi_cable_plate_1
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 45
Technic node placement player can place technic:hv_cable_plate_1
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 45
Technic node placement player can place technic:mv_cable_plate_1
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 45
Technic node placement player can place technic:lv_digi_cable_plate_1
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 62
Technic node placement cable plates normal placement plate_1
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 72
Technic node placement cable plates normal placement plate_2
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 82
Technic node placement cable plates normal placement plate_3
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 92
Technic node placement cable plates normal placement plate_4
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 103
Technic node placement cable plates normal placement plate_5
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 114
Technic node placement cable plates normal placement plate_6
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 133
Technic node placement cable plates middle aux1 placement heading X-
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 141
Technic node placement cable plates middle aux1 placement heading Y-
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 149
Technic node placement cable plates middle aux1 placement heading Z-
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 157
Technic node placement cable plates middle aux1 placement heading X+
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 166
Technic node placement cable plates middle aux1 placement heading Y+
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 174
Technic node placement cable plates middle aux1 placement heading Z+
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 191
Technic node placement cable plates aux1 placement pointing X+ edge heading Z+
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 199
Technic node placement cable plates aux1 placement pointing X+ edge heading Y-
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 216
Technic node placement cable plates aux1 placement pointing Z+ edge heading X-
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 224
Technic node placement cable plates aux1 placement pointing Z+ edge heading Y-
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 232
Technic node placement cable plates aux1 placement pointing Z+ edge heading X+
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Error → spec/nodes_spec.lua @ 240
Technic node placement cable plates aux1 placement pointing Z+ edge heading Y+
machines/register/cables.lua:111: attempt to perform arithmetic on field '?' (a nil value)

Comment on lines 109 to 111
local pointed_thing_diff = vector.direction(pointed_thing.above, pointed_thing.under)
local dir = math.abs(pointed_thing_diff.x + 2*pointed_thing_diff.y + 3*pointed_thing_diff.z) -- 1, 2 or 3
local num = dir + 3/2*(1+pointed_thing_diff[dir]) -- dir + additional offset
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was this supposed to do and how exactly does it handle placement options?

For now it does fail significant portion of test cases and instead of fixing bug it seems to be an attempt to rework whole user facing placement behavior.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • pointed_thing_diff : you know ;)
  • dir: the previously index, but reinforced
    • x = +/- 1 returns 1
    • y = +/- 1 returns 2
    • z = +/-1 returns 3
  • num : the number of the cable_plate_num model ; it's working like y = ax+b
    • dir + : because its keep that b which means the axis
    • 1+pointed_thing_diff[dir] :
      • returns 0 for x/y/z = -1
      • returns 2 for x/y/z = 1
    • *3/2 : add this offset of 0 or 2, depending on the value

This is relatively short, and understandable, according to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is but it is reworking whole placement behavior which in my opinion is not good thing to do.

Needs some more discussion about before going there. Bugs can be fixed without changing behavior, for that I'd of course give approval but for changing behavior without good enough reasoning reject from me.

Copy link
Member

@S-S-X S-S-X left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If going to make placement behavior completely different from what it was:
Update description and title, update tests and provide reasoning why new behavior is better for players than previous one.

If going to just fix crash then revert to original placement behavior but keep fixes (diagonal checks + vector.direction on 2 lines).

@Athozus
Copy link
Member Author

Athozus commented Apr 12, 2024

Reverted to previous commit (work on simplification attempt potentially for later).

@S-S-X
Copy link
Member

S-S-X commented Apr 12, 2024

Reverted to previous commit (work on simplification attempt potentially for later).

This does still need that diagonal placement check, was also dropped while reverting: #358 (comment)

Copy link
Member

@S-S-X S-S-X left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now, should fix placement crash for all over sized support nodes.

  • In some cases placement work correctly and probably how most would expect it to work.
  • In some cases placement is prevented to not crash it, some of these could have valid position for placement but are very few special cases so it is better just skip placement for now.

These changes were tested a bit too.

@Athozus
Copy link
Member Author

Athozus commented Apr 13, 2024

I rebased it, changes look fine. Ofc for this one a squash 😅

@S-S-X I let you do the action, if you have anything to add/change.

Copy link

Click for detailed source code test coverage report

Test coverage report for Technic CNC 87.39% in 11/14 files:

File                             Hits Missed Coverage
-----------------------------------------------------
programs.lua                   263  0      100.00%
materials/technic_worldgen.lua 32   0      100.00%
materials/init.lua             14   0      100.00%
materials/default.lua          183  0      100.00%
materials/basic_materials.lua  17   0      100.00%
init.lua                       16   0      100.00%
digilines.lua                  55   0      100.00%
cnc.lua                        53   0      100.00%
formspec.lua                   104  7      93.69%
api.lua                        222  43     83.77%
pipeworks.lua                  25   13     65.79%
materials/moreblocks.lua       0    29     0.00%
materials/ethereal.lua         0    37     0.00%
materials/bakedclay.lua        0    13     0.00%

Test coverage report for technic chests 45.58% in 6/6 files:

File          Hits Missed Coverage
----------------------------------
chests.lua    102  18     85.00%
init.lua      34   18     65.38%
register.lua  85   78     52.15%
formspec.lua  76   94     44.71%
inventory.lua 10   100    9.09%
digilines.lua 2    61     3.17%

Test coverage report for technic 66.93% in 97/97 files:

File                                      Hits Missed Coverage
--------------------------------------------------------------
max_lag.lua                               12   0      100.00%
materials.lua                             71   0      100.00%
machines/register/init.lua                15   0      100.00%
machines/register/freezer_recipes.lua     16   0      100.00%
machines/other/init.lua                   6    0      100.00%
machines/MV/solar_array.lua               12   0      100.00%
machines/MV/init.lua                      17   0      100.00%
machines/MV/grinder.lua                   17   0      100.00%
machines/MV/generator.lua                 9    0      100.00%
machines/MV/freezer.lua                   17   0      100.00%
machines/MV/extractor.lua                 17   0      100.00%
machines/MV/electric_furnace.lua          17   0      100.00%
machines/MV/compressor.lua                17   0      100.00%
machines/MV/centrifuge.lua                17   0      100.00%
machines/MV/cables.lua                    40   0      100.00%
machines/MV/battery_box.lua               17   0      100.00%
machines/MV/alloy_furnace.lua             19   0      100.00%
machines/LV/solar_array.lua               11   0      100.00%
machines/LV/init.lua                      17   0      100.00%
machines/LV/grinder.lua                   17   0      100.00%
machines/LV/generator.lua                 10   0      100.00%
machines/LV/electric_furnace.lua          16   0      100.00%
machines/LV/compressor.lua                21   0      100.00%
machines/LV/cables.lua                    41   0      100.00%
machines/LV/battery_box.lua               15   0      100.00%
machines/LV/alloy_furnace.lua             18   0      100.00%
machines/HV/solar_array.lua               11   0      100.00%
machines/HV/init.lua                      12   0      100.00%
machines/HV/grinder.lua                   17   0      100.00%
machines/HV/generator.lua                 9    0      100.00%
machines/HV/electric_furnace.lua          17   0      100.00%
machines/HV/compressor.lua                17   0      100.00%
machines/HV/cables.lua                    39   0      100.00%
machines/HV/battery_box.lua               17   0      100.00%
legacy.lua                                33   0      100.00%
crafts.lua                                134  0      100.00%
machines/LV/led.lua                       80   1      98.77%
items.lua                                 113  2      98.26%
config.lua                                48   1      97.96%
machines/register/compressor_recipes.lua  41   1      97.62%
machines/register/grindings.lua           39   1      97.50%
machines/LV/geothermal.lua                82   3      96.47%
machines/register/solar_array.lua         48   2      96.00%
machines/LV/solar_panel.lua               44   2      95.65%
machines/network.lua                      403  21     95.05%
machines/register/alloy_recipes.lua       41   3      93.18%
tools/init.lua                            13   1      92.86%
init.lua                                  25   2      92.59%
machines/LV/water_mill.lua                73   6      92.41%
machines/register/cables.lua              109  9      92.37%
machines/compat/tools.lua                 58   6      90.62%
machines/register/recipes.lua             134  14     90.54%
machines/LV/lamp.lua                      131  17     88.51%
register.lua                              28   4      87.50%
machines/register/grinder_recipes.lua     109  16     87.20%
tools/flashlight.lua                      65   14     82.28%
machines/register/battery_box.lua         249  54     82.18%
util/throttle.lua                         9    2      81.82%
machines/init.lua                         38   9      80.85%
machines/LV/extractor.lua                 18   5      78.26%
radiation.lua                             279  81     77.50%
machines/power_monitor.lua                63   19     76.83%
machines/register/centrifuge_recipes.lua  23   7      76.67%
machines/register/machine_base.lua        165  51     76.39%
machines/other/coal_furnace.lua           3    1      75.00%
machines/switching_station.lua            84   32     72.41%
effects.lua                               5    2      71.43%
machines/overload.lua                     12   5      70.59%
machines/MV/wind_mill.lua                 52   22     70.27%
machines/supply_converter.lua             98   46     68.06%
machines/MV/hydro_turbine.lua             49   26     65.33%
machines/other/injector.lua               80   45     64.00%
machines/switching_station_globalstep.lua 28   16     63.64%
tools/multimeter.lua                      130  78     62.50%
machines/register/generator.lua           127  83     60.48%
machines/MV/tool_workshop.lua             64   43     59.81%
machines/other/coal_alloy_furnace.lua     90   62     59.21%
tools/cans.lua                            54   48     52.94%
tools/mining_lasers.lua                   37   35     51.39%
machines/LV/music_player.lua              48   47     50.53%
machines/other/constructor.lua            78   77     50.32%
tools/tree_tap.lua                        25   30     45.45%
tools/vacuum.lua                          16   20     44.44%
machines/register/common.lua              51   64     44.35%
machines/HV/forcefield.lua                111  158    41.26%
machines/HV/nuclear_reactor.lua           139  214    39.38%
helpers.lua                               62   98     38.75%
machines/HV/quarry.lua                    152  250    37.81%
tools/sonic_screwdriver.lua               17   33     34.00%
tools/chainsaw.lua                        39   80     32.77%
machines/compat/api.lua                   16   34     32.00%
chatcommands.lua                          19   45     29.69%
tools/mining_drill.lua                    66   195    25.29%
machines/other/anchor.lua                 16   74     17.78%
tools/prospector.lua                      15   100    13.04%
machines/register/extractor_recipes.lua   8    77     9.41%
machines/compat/digtron.lua               4    41     8.89%

Raw test runner output for geeks:

CNC:

++ Executing suite spec/api_spec.lua
++ Executing suite spec/digilines_spec.lua
++ Executing suite spec/interaction_spec.lua
++ Executing suite spec/technic_cnc_spec.lua⭆ Starting test set technic_cnc_spec.lua:17 ⯈ Technic CNC
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded


31 successes / 0 failures / 0 errors / 0 pending : 12.812899 seconds

Chests:

++ Executing suite spec/api_spec.lua
W:	Configuration: invalid key	exclude_textures


5 successes / 0 failures / 0 errors / 0 pending : 0.320688 seconds

Technic:

++ Executing suite spec/api_spec.lua
E:	Loading common/fs from 5.4.1 failed, trying to use builtin
◌◌⭆ Starting test set api_spec.lua:204 ⯈ Technic API Machine use
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
◌
++ Executing suite spec/building_spec.lua
E:	Loading common/fs from 5.4.1 failed, trying to use builtin

++ Executing suite spec/hv_network_spec.lua
E:	Loading common/fs from 5.4.1 failed, trying to use builtin
⭆ Starting test set hv_network_spec.lua:11 ⯈ HV machine network
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded

++ Executing suite spec/lv_network_spec.lua
E:	Loading common/fs from 5.4.1 failed, trying to use builtin
⭆ Starting test set lv_network_spec.lua:11 ⯈ LV machine network
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded

++ Executing suite spec/network_spec.lua
E:	Loading common/fs from 5.4.1 failed, trying to use builtin

++ Executing suite spec/nodes_spec.lua
E:	Loading common/fs from 5.4.1 failed, trying to use builtin
⭆ Starting test set nodes_spec.lua:11 ⯈ Technic node placement
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded

++ Executing suite spec/supply_converter_spec.lua
E:	Loading common/fs from 5.4.1 failed, trying to use builtin
◌
++ Executing suite spec/tools_compatibility_spec.lua
E:	Loading common/fs from 5.4.1 failed, trying to use builtin
⭆ Starting test set tools_compatibility_spec.lua:11 ⯈ Technic power tool compatibility
W:	Deprecated technic.register_power_tool use. Setting max_charge for oldlegacy:powertool
W:	Deprecated technic.register_power_tool use. Setting max_charge for oldminimal:powertool
W:	Deprecated technic.register_power_tool use. Setting max_charge for oldhalfway:powertool
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Deprecated technic.register_power_tool use. Ensuring fields for oldlegacy:powertool
W:	Using metadata charge values for oldlegacy:powertool
W:	Updated legacy Technic power tool definition for oldlegacy:powertool
W:	Deprecated technic.register_power_tool use. Ensuring fields for oldminimal:powertool
W:	Using metadata charge values for oldminimal:powertool
W:	Updated legacy Technic power tool definition for oldminimal:powertool
W:	Deprecated technic.register_power_tool use. Ensuring fields for oldhalfway:powertool
W:	Mod oldhalfway seems to be aware of technic.plus but oldhalfway:powertool is still using deprecated registration, skipping meta charge compatibility.
W:	Updated legacy Technic power tool definition for oldhalfway:powertool
🢆 Running tests from tools_compatibility_spec.lua:92 ▷ Technic power tool compatibility oldlegacy:powertool can be used (minimum charge)
W:	Use of deprecated function technic.set_RE_wear with stack: oldlegacy:powertool
🢆 Running tests from tools_compatibility_spec.lua:106 ▷ Technic power tool compatibility oldlegacy:powertool can be used (minimum charge + 1)
W:	Use of deprecated function technic.set_RE_wear with stack: oldlegacy:powertool
🢆 Running tests from tools_compatibility_spec.lua:92 ▷ Technic power tool compatibility oldminimal:powertool can be used (minimum charge)
W:	Use of deprecated function technic.set_RE_wear with stack: oldminimal:powertool
🢆 Running tests from tools_compatibility_spec.lua:106 ▷ Technic power tool compatibility oldminimal:powertool can be used (minimum charge + 1)
W:	Use of deprecated function technic.set_RE_wear with stack: oldminimal:powertool

++ Executing suite spec/tools_spec.lua
E:	Loading common/fs from 5.4.1 failed, trying to use builtin
⭆ Starting test set tools_spec.lua:13 ⯈ Technic power tool
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded


219 successes / 0 failures / 0 errors / 4 pending : 87.777487 seconds

Pending → spec/api_spec.lua @ 133
Technic API Machine registration registers my_mod:my_battery
spec/api_spec.lua:133: Battery box registration does not include all fields

Pending → spec/api_spec.lua @ 190
Technic API Machine registration registers my_mod:machine_base
spec/api_spec.lua:190: Base machine registration does not include all fields

Pending → spec/api_spec.lua @ 285
Technic API internals technic.cables TBD, misleading name and should be updated
spec/api_spec.lua:285: TBD technic.cables naming and need, see technic networks data for possible options

Pending → spec/supply_converter_spec.lua @ 78
Supply converter building overloads network
spec/supply_converter_spec.lua:78: overload does not work with supply converter

@S-S-X
Copy link
Member

S-S-X commented Apr 14, 2024

Another PR was merged so rebased again, most testing I did was exactly for these changes / current state and there's multiple automated tests confirming that most placements work like before. Should be good enough so merging this.

@S-S-X S-S-X merged commit ad2c11e into master Apr 14, 2024
10 checks passed
@S-S-X S-S-X deleted the nil-cable-plate branch April 14, 2024 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nil index with cable plate
3 participants