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)
|
||||
local r = tonumber(fields.radius)
|
||||
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
|
||||
|
||||
@ -36,23 +37,19 @@ local object_detector_scan = function (pos)
|
||||
local scanname = meta:get_string("scanname")
|
||||
local scan_all = scanname == ""
|
||||
local scan_names = scanname:split(',')
|
||||
local radius = meta:get_int("radius")
|
||||
if radius == 0 then
|
||||
radius = 6
|
||||
end
|
||||
local max_radius = moremesecons.setting("entity_detector", "max_radius", 16, 0)
|
||||
local radius = math.min(tonumber(meta:get("radius")) or 6, max_radius)
|
||||
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
|
||||
if isname then
|
||||
if scan_all then
|
||||
for _, name in ipairs(scan_names) do
|
||||
if isname == name or (isname == "__builtin:item" and luaentity.itemstring == name) then
|
||||
return true
|
||||
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
|
||||
|
@ -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
|
||||
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]
|
||||
|
||||
# Jammer action range
|
||||
|
Loading…
Reference in New Issue
Block a user