Compare commits

...

6 Commits

Author SHA1 Message Date
Vitaliy Olkhin
5c9695e242 Added a lock to the tool node destroyer to prevent the stone block from being destroyed. This need was removed from stone generation if a sieve-type mod is used on the server.
Some checks failed
luacheck / luacheck (push) Has been cancelled
2024-11-10 16:33:51 +05:00
Vitaliy Olkhin
fa610bebe3 small fix, added the ability to enable debug for debugging code
Some checks failed
luacheck / luacheck (push) Has been cancelled
2024-11-06 13:52:14 +05:00
Vitaliy Olkhin
2111a21f68 Added a check against constant reading of the array if the player is not on the server.
Some checks are pending
luacheck / luacheck (push) Waiting to run
2024-11-05 18:47:59 +05:00
Deathwing777
a094097b5e Fixes Issue #64 (#142)
Some checks failed
luacheck / luacheck (push) Has been cancelled
* Fixes Issue #64

Uses a simple boolean setting in default_settings.lua to decide which digiline rules to use in common.lua

* Reviewer Suggestion

Co-authored-by: SX <50966843+S-S-X@users.noreply.github.com>

* Changed Code Comment per Reviewer Suggestion

* Removed trailing whitespace from 2 comment lines.

* Modified settings comment per reviewer suggestion

* Changed variable name per reviewer suggestion.

Variable changed from use_default_digilines_rules to enable_vertical_digilines_connectivity.

---------

Co-authored-by: SX <50966843+S-S-X@users.noreply.github.com>
2024-11-04 12:06:51 +05:00
Vitaliy Olkhin
2947881b1e testing
Some checks are pending
luacheck / luacheck (push) Waiting to run
2024-11-04 11:56:30 +05:00
1F616EMO~nya
222a865e17
Allow digging injectors without clearing the filter (#141)
Thie PR allows diging injectors without clearing their filter inventory. I can't see a reason why this was nessessary.
2024-10-20 12:13:20 -04:00
8 changed files with 92 additions and 41 deletions

View File

@ -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

View File

@ -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 = {}

View File

@ -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}},
}

View File

@ -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

View File

@ -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,7 +78,9 @@ 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))
tube_item_count[h] = (tube_item_count[h] or 0) + 1
if type(tube_item_count[h]) ~= 'nil' then
tube_item_count[h] = (tube_item_count[h] or 0) + 1
end
end
end
end)

View File

@ -349,44 +349,61 @@ 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
local master = entity._attached_entities_master
local master_def = master and entity._attached_entities[master]
local master_entity = master_def and master_def.entity
local master_entity_pos = master_entity and master_entity:get_pos()
if master_entity_pos then
entity._pos = vector.subtract(master_entity_pos, master_def.offset)
entity._velocity = master_entity:get_velocity()
entity._acceleration = master_entity:get_acceleration()
else
entity._velocity = entity._velocity or vector.new(0,0,0)
entity._acceleration = entity._acceleration or vector.new(0,0,0)
entity._pos = vector.add(vector.add(
entity._pos,
vector.multiply(entity._velocity, dtime)),
vector.multiply(entity._acceleration, 0.5 * dtime * dtime))
entity._velocity = vector.add(
entity._velocity,
vector.multiply(entity._acceleration, dtime))
--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 master and not master_entity_pos then -- The entity has somehow been cleared
if pipeworks.delete_item_on_clearobject then
entity:remove()
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
local master_entity_pos = master_entity and master_entity:get_pos()
if master_entity_pos then
entity._pos = vector.subtract(master_entity_pos, master_def.offset)
entity._velocity = master_entity:get_velocity()
entity._acceleration = master_entity:get_acceleration()
else
entity._velocity = entity._velocity or vector.new(0,0,0)
entity._acceleration = entity._acceleration or vector.new(0,0,0)
entity._pos = vector.add(vector.add(
entity._pos,
vector.multiply(entity._velocity, dtime)),
vector.multiply(entity._acceleration, 0.5 * dtime * dtime))
entity._velocity = vector.add(
entity._velocity,
vector.multiply(entity._acceleration, dtime))
end
if master and not master_entity_pos then -- The entity has somehow been cleared
if pipeworks.delete_item_on_clearobject then
entity:remove()
else
entity:_remove_attached(master)
entity:_add_loaded()
if entity.on_step then
entity:on_step(dtime)
end
end
else
entity:_remove_attached(master)
entity:_add_loaded()
if entity.on_step then
entity:on_step(dtime)
end
end
else
entity:_add_loaded()
if entity.on_step then
entity:on_step(dtime)
end
end
end
end

View File

@ -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

View File

@ -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()