-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into bed-compat-ng
- Loading branch information
Showing
51 changed files
with
719 additions
and
8,578 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: test | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: buckaroobanzay/mtt@main | ||
with: | ||
modname: jumpdrive | ||
git_dependencies: | | ||
https://github.com/minetest-mods/areas.git |
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
-- | ||
-- Compatibility hacks for technic plus new network system | ||
-- | ||
-- More information: | ||
-- https://github.com/mt-mods/technic/issues/100 | ||
-- | ||
-- See also proposal draft to actually move networks instead of rebuilding: | ||
-- https://github.com/mt-mods/jumpdrive/pull/79 | ||
-- | ||
|
||
-- Check for technic mod version compatibility | ||
if technic.remove_network and technic.pos2network and technic.machines then | ||
|
||
local function on_movenode(from_pos, to_pos, info) | ||
-- Destroy network caches at source location, inside jump area | ||
local src_net_id = technic.pos2network(from_pos) | ||
if src_net_id then | ||
technic.remove_network(src_net_id) | ||
end | ||
|
||
-- Destroy network caches at target location, outside jump area | ||
local edge = info.edge | ||
for axis, value in pairs(edge) do | ||
if value ~= 0 then | ||
local axis_dir = {x=0,y=0,z=0} | ||
axis_dir[axis] = value | ||
local edge_pos = vector.add(to_pos, axis_dir) | ||
local dst_net_id = technic.pos2network(edge_pos) | ||
if dst_net_id then | ||
technic.remove_network(dst_net_id) | ||
end | ||
end | ||
end | ||
end | ||
|
||
-- Collect groups for registered technic cables | ||
local cable_groups = {} | ||
for tier,_ in pairs(technic.machines) do | ||
cable_groups[("technic_%s_cable"):format(tier:lower())] = 1 | ||
end | ||
|
||
local function is_network_node(_, def) | ||
if not def.groups then return end | ||
for group,_ in pairs(cable_groups) do | ||
if def.groups[group] then return true end | ||
end | ||
return def.groups["technic_machine"] | ||
end | ||
|
||
-- Inject on_movenode functionality but only if node does not already implement it | ||
for name, def in pairs(minetest.registered_nodes) do | ||
if not def.on_movenode and is_network_node(name, def) then | ||
minetest.override_item(name, { on_movenode = on_movenode }) | ||
end | ||
end | ||
|
||
end |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
|
||
local textline_def = minetest.registered_nodes["textline:lcd"] | ||
assert(textline_def) | ||
assert(textline_def.after_place_node) | ||
|
||
-- refresh textline entities after the jump | ||
minetest.override_item("textline:lcd", { | ||
on_movenode = function(from_pos, to_pos) | ||
minetest.after(1, function() | ||
textline_def.after_place_node(to_pos) | ||
end) | ||
local delta_vector = vector.subtract(to_pos, from_pos) | ||
local objects = minetest.get_objects_inside_radius(from_pos, 0.5) | ||
for _,object in ipairs(objects) do | ||
local entity = object:get_luaentity() | ||
if entity and entity.name == "textline:text" then | ||
object:set_pos(vector.add(object:get_pos(), delta_vector)) | ||
end | ||
end | ||
end | ||
}) |
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
Oops, something went wrong.