Skip to content

Re-fix and simplify anchor mapblock calculation#427

Merged
OgelGames merged 1 commit intomasterfrom
anchor-fix
Feb 3, 2026
Merged

Re-fix and simplify anchor mapblock calculation#427
OgelGames merged 1 commit intomasterfrom
anchor-fix

Conversation

@OgelGames
Copy link
Contributor

Fixes the unfixing of #425 while also simplifying the code to make it more readable.

@github-actions
Copy link

github-actions bot commented Feb 2, 2026

Click for detailed source code test coverage report

Test coverage report for Technic CNC 87.49% 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                        231  43     84.31%
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.06% 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   93     44.97%
inventory.lua 11   110    9.09%
digilines.lua 2    61     3.17%

Test coverage report for technic 70.92% in 96/96 files:

File                                      Hits Missed Coverage
--------------------------------------------------------------
max_lag.lua                               12   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                 8    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%
items.lua                                 113  0      100.00%
effects.lua                               23   0      100.00%
crafts.lua                                134  0      100.00%
chatcommands.lua                          66   0      100.00%
config.lua                                48   1      97.96%
machines/register/compressor_recipes.lua  41   1      97.62%
machines/register/grindings.lua           39   1      97.50%
materials.lua                             72   2      97.30%
machines/LV/geothermal.lua                84   3      96.55%
machines/LV/led.lua                       78   3      96.30%
machines/register/solar_array.lua         48   2      96.00%
machines/network.lua                      402  17     95.94%
machines/LV/solar_panel.lua               44   2      95.65%
machines/register/alloy_recipes.lua       41   3      93.18%
machines/register/cables.lua              109  8      93.16%
tools/init.lua                            13   1      92.86%
machines/LV/water_mill.lua                73   6      92.41%
init.lua                                  24   2      92.31%
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/prospector.lua                      99   16     86.09%
machines/other/coal_alloy_furnace.lua     132  24     84.62%
machines/register/battery_box.lua         252  54     82.35%
tools/flashlight.lua                      65   14     82.28%
util/throttle.lua                         9    2      81.82%
machines/init.lua                         38   9      80.85%
machines/compat/tools.lua                 62   17     78.48%
machines/LV/extractor.lua                 18   5      78.26%
machines/register/machine_base.lua        171  48     78.08%
radiation.lua                             279  81     77.50%
machines/power_monitor.lua                63   19     76.83%
machines/register/centrifuge_recipes.lua  23   7      76.67%
machines/other/coal_furnace.lua           3    1      75.00%
machines/switching_station.lua            85   32     72.65%
machines/overload.lua                     12   5      70.59%
machines/MV/wind_mill.lua                 52   22     70.27%
machines/HV/nuclear_reactor.lua           248  111    69.08%
machines/supply_converter.lua             98   46     68.06%
machines/switching_station_globalstep.lua 29   15     65.91%
machines/MV/hydro_turbine.lua             49   26     65.33%
machines/other/injector.lua               83   45     64.84%
machines/register/common.lua              86   48     64.18%
tools/multimeter.lua                      132  76     63.46%
machines/MV/tool_workshop.lua             67   43     60.91%
machines/register/generator.lua           127  83     60.48%
tools/cans.lua                            54   48     52.94%
machines/other/constructor.lua            84   77     52.17%
tools/mining_lasers.lua                   37   35     51.39%
machines/LV/music_player.lua              48   47     50.53%
tools/tree_tap.lua                        25   30     45.45%
tools/vacuum.lua                          16   20     44.44%
machines/HV/forcefield.lua                111  156    41.57%
helpers.lua                               62   98     38.75%
machines/HV/quarry.lua                    155  248    38.46%
machines/compat/api.lua                   20   34     37.04%
tools/sonic_screwdriver.lua               17   33     34.00%
tools/chainsaw.lua                        40   81     33.06%
tools/mining_drill.lua                    66   195    25.29%
machines/other/anchor.lua                 16   70     18.60%
machines/register/extractor_recipes.lua   9    77     10.47%
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
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded

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

Chests:

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

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

Technic:

++ Executing suite spec/api_spec.lua◌◌⭆ Starting test set api_spec.lua:209 ⯈ Technic API Machine use
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
◌
++ Executing suite spec/building_spec.lua🢆 Running tests from building_spec.lua:128 ▷ Power network building machine building does not crash
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
🢆 Running tests from building_spec.lua:135 ▷ Power network building machine building is added to network without duplicates
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
🢆 Running tests from building_spec.lua:181 ▷ Power network building cable building between networks does not crash
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
🢆 Running tests from building_spec.lua:210 ▷ Power network building cable cutting does not crash
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
🢆 Running tests from building_spec.lua:259 ▷ Power network building cable digging below machine does not crash
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
🢆 Running tests from building_spec.lua:266 ▷ Power network building cable digging below machine is removed from network
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
🢆 Running tests from building_spec.lua:280 ▷ Power network building cable digging below machine keeps connected machines in network
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
🢆 Running tests from building_spec.lua:306 ▷ Power network building machine digging does not crash
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
🢆 Running tests from building_spec.lua:317 ▷ Power network building machine digging does not remove other nodes from network
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.

++ Executing suite spec/chatcommands_spec.lua⭆ Starting test set chatcommands_spec.lua:7 ⯈ Chat command
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
🢆 Running tests from  call):-1 ▷ Chat command denies /powerctrl off
Sam	You don't have permission to run this command (missing privileges: basic_privs)
🢆 Running tests from  call):-1 ▷ Chat command denies /powerctrl on
Sam	You don't have permission to run this command (missing privileges: basic_privs)
🢆 Running tests from  call):-1 ▷ Chat command denies /technic_get_active_networks
Sam	You don't have permission to run this command (missing privileges: basic_privs)
🢆 Running tests from  call):-1 ▷ Chat command denies /technic_flush_switch_cache
Sam	You don't have permission to run this command (missing privileges: basic_privs)
🢆 Running tests from  call):-1 ▷ Chat command denies /technic_clear_network_data
Sam	You don't have permission to run this command (missing privileges: basic_privs)
🢆 Running tests from  call):-1 ▷ Chat command allows /powerctrl
SX	Technic network globalstep enabled.
🢆 Running tests from  call):-1 ▷ Chat command allows /powerctrl off
SX	Technic network globalstep disabled.
🢆 Running tests from  call):-1 ▷ Chat command allows /powerctrl on
SX	Technic network globalstep enabled.
🢆 Running tests from  call):-1 ▷ Chat command allows /technic_get_active_networks
SX	Cached networks: 1 active, 1 total, 3 nodes, 0.00 max lag.
Pos:             (1,50,2) PR:   1 RE:   0 BA:   0 Skip:  0 Lag:  0.30ms
🢆 Running tests from  call):-1 ▷ Chat command allows /technic_flush_switch_cache
SX	Network data removed: 1 active networks deactivated.
🢆 Running tests from  call):-1 ▷ Chat command allows /technic_clear_network_data
SX	Network data removed: 1 active networks, 1 total networks, 3 network nodes.

++ Executing suite spec/hv_network_spec.lua⭆ Starting test set hv_network_spec.lua:11 ⯈ HV machine network
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded

++ Executing suite spec/lv_network_spec.lua⭆ Starting test set lv_network_spec.lua:11 ⯈ LV machine network
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded

++ Executing suite spec/network_spec.lua🢆 Running tests from network_spec.lua:97 ▷ Power network helper network constructors/destructors builds network
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
🢆 Running tests from network_spec.lua:107 ▷ Power network helper network constructors/destructors does not add duplicates to network
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
🢆 Running tests from network_spec.lua:225 ▷ technic.merge_networks function behavior merges networks
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
🢆 Running tests from network_spec.lua:243 ▷ technic.merge_networks function behavior merges networks again
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
🢆 Running tests from network_spec.lua:301 ▷ technic.merge_networks network building behavior stops network building after first iteration
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
🢆 Running tests from network_spec.lua:316 ▷ technic.merge_networks network building behavior continues network building
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
🢆 Running tests from network_spec.lua:330 ▷ technic.merge_networks network building behavior merges with second network
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
🢆 Running tests from network_spec.lua:352 ▷ technic.merge_networks network building behavior finishes network build
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.

++ Executing suite spec/nodes_spec.lua⭆ Starting test set nodes_spec.lua:11 ⯈ Technic node placement
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded

++ Executing suite spec/nuclear_reactor_spec.lua⭆ Starting test set nuclear_reactor_spec.lua:7 ⯈ Nuclear reactor
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
🢆 Running tests from nuclear_reactor_spec.lua:67 ▷ Nuclear reactor generates energy
SX	Start successful

++ Executing suite spec/other_spec.lua⭆ Starting test set other_spec.lua:11 ⯈ Coal alloy furnace
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
🢆 Running tests from other_spec.lua:45 ▷ Coal alloy furnace wont crash without placement callbacks
W: InvRef:get_list list not found: 'src'

++ Executing suite spec/supply_converter_spec.lua🢆 Running tests from supply_converter_spec.lua:40 ▷ Supply converter building does not crash
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
🢆 Running tests from supply_converter_spec.lua:51 ▷ Supply converter building is added to network without duplicates
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
◌🢆 Running tests from supply_converter_spec.lua:102 ▷ Supply converter digging does not crash
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.
🢆 Running tests from supply_converter_spec.lua:116 ▷ Supply converter digging does not remove other nodes from network
E:	Using deprecated global function 'count', use 'mineunit.utils.count' instead.

++ Executing suite spec/tools_compatibility_spec.lua⭆ 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:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
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⭆ Starting test set tools_spec.lua:13 ⯈ Technic power tool
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
W:	Unsupported registration overrides detected for core.registered_on_mods_loaded
🢆 Running tests from tools_spec.lua:418 ▷ Technic power tool Prospector new item can be used
SX	Right-click to set target block type
🢆 Running tests from tools_spec.lua:445 ▷ Technic power tool Prospector charge is used
SX	@1 is present in @2 region stone description 1x1x7

243 successes / 0 failures / 0 errors / 4 pending : 26.44775 seconds

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

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

Pending → spec/api_spec.lua @ 290
Technic API internals technic.cables TBD, misleading name and should be updated
spec/api_spec.lua:290: 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

@OgelGames
Copy link
Contributor Author

@j-r

Copy link

@j-r j-r left a comment

Choose a reason for hiding this comment

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

Works, thank you!

@OgelGames OgelGames merged commit f8948ad into master Feb 3, 2026
6 checks passed
@OgelGames OgelGames deleted the anchor-fix branch February 3, 2026 00:11
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.

2 participants