forked from minetest-mods/MoreMesecons
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
db6918297c
10
.github/workflows/luacheck.yml
vendored
Normal file
10
.github/workflows/luacheck.yml
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
name: luacheck
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
luacheck:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@master
|
||||||
|
- name: Luacheck
|
||||||
|
uses: lunarmodules/luacheck@master
|
@ -26,7 +26,8 @@ local function object_detector_on_receive_fields(pos, _, fields, player)
|
|||||||
meta:set_string("digiline_channel", fields.digiline_channel)
|
meta:set_string("digiline_channel", fields.digiline_channel)
|
||||||
local r = tonumber(fields.radius)
|
local r = tonumber(fields.radius)
|
||||||
if r then
|
if r then
|
||||||
meta:set_int("radius", r)
|
local max_radius = moremesecons.setting("entity_detector", "max_radius", 16, 0)
|
||||||
|
meta:set_int("radius", math.min(r, max_radius))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -36,23 +37,19 @@ local object_detector_scan = function (pos)
|
|||||||
local scanname = meta:get_string("scanname")
|
local scanname = meta:get_string("scanname")
|
||||||
local scan_all = scanname == ""
|
local scan_all = scanname == ""
|
||||||
local scan_names = scanname:split(',')
|
local scan_names = scanname:split(',')
|
||||||
local radius = meta:get_int("radius")
|
local max_radius = moremesecons.setting("entity_detector", "max_radius", 16, 0)
|
||||||
if radius == 0 then
|
local radius = math.min(tonumber(meta:get("radius")) or 6, max_radius)
|
||||||
radius = 6
|
|
||||||
end
|
|
||||||
for _,obj in pairs(minetest.get_objects_inside_radius(pos, radius)) do
|
for _,obj in pairs(minetest.get_objects_inside_radius(pos, radius)) do
|
||||||
if not obj:is_player() then
|
local luaentity = obj:get_luaentity()
|
||||||
local luaentity = obj:get_luaentity()
|
if luaentity then
|
||||||
|
if scan_all then
|
||||||
|
return true
|
||||||
|
end
|
||||||
local isname = luaentity.name
|
local isname = luaentity.name
|
||||||
if isname then
|
for _, name in ipairs(scan_names) do
|
||||||
if scan_all then
|
if isname == name or (isname == "__builtin:item" and luaentity.itemstring == name) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
for _, name in ipairs(scan_names) do
|
|
||||||
if isname == name or (isname == "__builtin:item" and luaentity.itemstring == name) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -13,6 +13,10 @@ moremesecons_commandblock.authorized_commands (Authorized commands) string tell
|
|||||||
# Any value less than or equal to 0 will be changed to 1 and a NaN value will be changed to the default value
|
# Any value less than or equal to 0 will be changed to 1 and a NaN value will be changed to the default value
|
||||||
moremesecons_commandblock.nearest_max_distance (Nearest player maximum distance) float 8
|
moremesecons_commandblock.nearest_max_distance (Nearest player maximum distance) float 8
|
||||||
|
|
||||||
|
[Entity Detector]
|
||||||
|
|
||||||
|
moremesecons_entity_detector.max_radius (Maximum entity detector radius) float 16 0
|
||||||
|
|
||||||
[Signal Jammer]
|
[Signal Jammer]
|
||||||
|
|
||||||
# Jammer action range
|
# Jammer action range
|
||||||
|
Loading…
Reference in New Issue
Block a user