Compare commits
6 Commits
main
...
optimizati
Author | SHA1 | Date | |
---|---|---|---|
|
5c9695e242 | ||
|
fa610bebe3 | ||
|
2111a21f68 | ||
|
a094097b5e | ||
|
2947881b1e | ||
|
222a865e17 |
12
common.lua
12
common.lua
@ -15,7 +15,17 @@ pipeworks.rules_all = {{x=0, y=0, z=1},{x=0, y=0, z=-1},{x=1, y=0, z=0},{x=-1, y
|
||||
{x=0, y=1, z=0}, {x=0, y=-1, z=0}}
|
||||
|
||||
pipeworks.mesecons_rules={{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=1,z=0},{x=0,y=-1,z=0}}
|
||||
pipeworks.digilines_rules={{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=1,z=0},{x=0,y=-1,z=0}}
|
||||
|
||||
local digilines_enabled = minetest.get_modpath("digilines") ~= nil
|
||||
if digilines_enabled and pipeworks.enable_vertical_digilines_connectivity then
|
||||
pipeworks.digilines_rules=digiline.rules.default
|
||||
else
|
||||
-- These rules break vertical connectivity to deployers, node breakers, dispensers, and digiline filter injectors
|
||||
-- via digiline conducting tubes. Changing them may break some builds on some servers, so the setting was added
|
||||
-- for server admins to be able to revert to the old "broken" behavior as some builds may use it as a "feature".
|
||||
-- See https://github.com/mt-mods/pipeworks/issues/64
|
||||
pipeworks.digilines_rules={{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=1,z=0},{x=0,y=-1,z=0}}
|
||||
end
|
||||
|
||||
pipeworks.liquid_texture = minetest.registered_nodes[pipeworks.liquids.water.flowing].tiles[1]
|
||||
if type(pipeworks.liquid_texture) == "table" then pipeworks.liquid_texture = pipeworks.liquid_texture.name end
|
||||
|
@ -31,6 +31,9 @@ local settings = {
|
||||
delete_item_on_clearobject = true,
|
||||
use_real_entities = true,
|
||||
entity_update_interval = 0,
|
||||
enable_vertical_digilines_connectivity = true,
|
||||
enable_node_destroyer_from_tool = true,
|
||||
enable_debug = false,
|
||||
}
|
||||
|
||||
pipeworks.toggles = {}
|
||||
|
@ -451,11 +451,6 @@ for _, data in ipairs({
|
||||
if not pipeworks.may_configure(pos, player) then return 0 end
|
||||
return count
|
||||
end,
|
||||
can_dig = function(pos, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("main")
|
||||
end,
|
||||
tube = {connect_sides = {right = 1}},
|
||||
}
|
||||
|
||||
|
8
init.lua
8
init.lua
@ -21,13 +21,7 @@ pipeworks = {
|
||||
}
|
||||
|
||||
dofile(pipeworks.modpath.."/default_settings.lua")
|
||||
-- Read the external config file if it exists.
|
||||
local worldsettingspath = pipeworks.worldpath.."/pipeworks_settings.txt"
|
||||
local worldsettingsfile = io.open(worldsettingspath, "r")
|
||||
if worldsettingsfile then
|
||||
worldsettingsfile:close()
|
||||
dofile(worldsettingspath)
|
||||
end
|
||||
|
||||
if pipeworks.toggles.pipe_mode == "pressure" then
|
||||
minetest.log("warning", "pipeworks pressure logic mode comes with caveats and differences in behaviour, you have been warned!")
|
||||
end
|
||||
|
@ -61,9 +61,16 @@ function pipeworks.notvel(tbl, vel)
|
||||
return tbl2
|
||||
end
|
||||
|
||||
local timer = 0
|
||||
local tube_item_count = {}
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
-- every 5 seconds
|
||||
if timer > os.time() then
|
||||
return
|
||||
end
|
||||
timer = os.time() + 1
|
||||
|
||||
if not luaentity.entities then
|
||||
return
|
||||
end
|
||||
@ -71,9 +78,11 @@ minetest.register_globalstep(function(dtime)
|
||||
for _, entity in pairs(luaentity.entities) do
|
||||
if entity.name == "pipeworks:tubed_item" then
|
||||
local h = minetest.hash_node_position(vector.round(entity._pos))
|
||||
if type(tube_item_count[h]) ~= 'nil' then
|
||||
tube_item_count[h] = (tube_item_count[h] or 0) + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
|
@ -349,10 +349,25 @@ function luaentity.get_objects_inside_radius(pos, radius)
|
||||
end
|
||||
|
||||
local move_entities_globalstep_part2 = function(dtime)
|
||||
local object = {}
|
||||
if not luaentity.entities then
|
||||
luaentity.entities = read_entities()
|
||||
end
|
||||
--minetest.log("action", "Dump: " .. dump(luaentity.entities))
|
||||
for _, entity in pairs(luaentity.entities) do
|
||||
--minetest.log("action", "entity " .. type(entity.owner))
|
||||
--minetest.chat_send_all("online: " .. dump(entity.owner))
|
||||
|
||||
if entity.owner ~= nil then
|
||||
object = minetest.env:get_player_by_name(entity.owner)
|
||||
end
|
||||
|
||||
if object or entity.owner ~= nil then
|
||||
--minetest.chat_send_all("online: " .. dump(entity.owner))
|
||||
if pipeworks.enable_debug then
|
||||
minetest.log("action", "pipeworks: активная передача по трубам игрок в сети: " .. dump(entity.owner))
|
||||
end
|
||||
|
||||
local master = entity._attached_entities_master
|
||||
local master_def = master and entity._attached_entities[master]
|
||||
local master_entity = master_def and master_def.entity
|
||||
@ -388,6 +403,8 @@ local move_entities_globalstep_part2 = function(dtime)
|
||||
entity:on_step(dtime)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -85,9 +85,24 @@ pipeworks_use_real_entities (Use Real Entities) bool true
|
||||
#A value 0.2 or above may cause issues with accelerator tubes.
|
||||
pipeworks_entity_update_interval (Entity Update Interval) float 0 0 0.8
|
||||
|
||||
# Use the default rules from the digilines mod.
|
||||
# If enabled the following devices will connect to digiline networks in the vertical direction:
|
||||
# digiline filter injector, deployer, dispenser, node breaker, autocrafter
|
||||
# If disabled, the devices will not be able to send or recieve digiline signals from the top
|
||||
# or bottom faces, regardless of the node rotation. This breaks expected behavior with digiline
|
||||
# conducting tubes, so it is recommended to enable this option unless you have specific builds
|
||||
# that make use of the lack of vertical digiline connectivity and those are more important to you.
|
||||
enable_vertical_digilines_connectivity (Use the default rules from the digilines mod) bool true
|
||||
|
||||
# if set to true, items passing through teleport tubes will log log where they came from and where they went.
|
||||
pipeworks_log_teleport_tubes (Log Teleport Tubes) bool false
|
||||
|
||||
# Behavior of print() inside a lua tube. By default, this emits a message into actionstream.
|
||||
# Set it to noop if you wish to disable that behavior.
|
||||
pipeworks_lua_tube_print_behavior (Behavior of print in Lua Tube) enum log log,noop
|
||||
|
||||
#Disconnect node destroyer from tool
|
||||
pipeworks_enable_node_destroyer_from_tool = true
|
||||
|
||||
pipeworks_enable_debug (Enable debug) bool false
|
||||
|
||||
|
@ -261,6 +261,14 @@ if pipeworks.enable_node_breaker then
|
||||
end
|
||||
-- Check if the tool can dig the node
|
||||
local tool = stack:get_tool_capabilities()
|
||||
if pipeworks.enable_debug then
|
||||
minetest.log("action", "pipeworks: tool: " .. dump(tool))
|
||||
end
|
||||
|
||||
if tool.punch_attack_uses > 0 and pipeworks.enable_node_destroyer_from_tool == false then
|
||||
return
|
||||
end
|
||||
|
||||
if not minetest.get_dig_params(node_def.groups, tool).diggable then
|
||||
-- Try using hand if tool can't dig the node
|
||||
local hand = ItemStack():get_tool_capabilities()
|
||||
|
Loading…
Reference in New Issue
Block a user