feat: say commands + temp disable scanner

This commit is contained in:
minish 2026-02-18 03:29:54 -05:00
parent 4927c6433d
commit 5400c4db42
Signed by: min
SSH Key Fingerprint: SHA256:mf+pUTmK92Y57BuCjlkBdd82LqztTfDCQIUp0fCKABc
2 changed files with 54 additions and 18 deletions

View File

@ -88,6 +88,18 @@ local function say(msg)
end) end)
end end
local function sayas(plr, msg)
dispatch(function(bx)
bx.sendMessage(msg, plr, "<>")
end)
end
local function sayserver(msg)
dispatch(function(bx)
bx.sendMessage(msg, "Server", "[]")
end)
end
local function faketpa(tgtplr, sender, fakeplr, fakemsg) local function faketpa(tgtplr, sender, fakeplr, fakemsg)
dispatch(function(bx) dispatch(function(bx)
local clickEvent = { local clickEvent = {
@ -146,5 +158,7 @@ return {
userBc = userBc, userBc = userBc,
reportLog = reportLog, reportLog = reportLog,
say = say, say = say,
sayas = sayas,
sayserver = sayserver,
faketpa = faketpa, faketpa = faketpa,
} }

View File

@ -147,6 +147,27 @@ local cmds = {
ch.say(msg) ch.say(msg)
end, end,
sayas = function(unm, args)
local plr = table.remove(args, 1)
local msg = table.concat(args, " ")
if not plr or #msg == 0 then
ch.send(unm, "must specify player and message")
return
end
ch.sayas(plr, msg)
end,
sayserver = function(unm, args)
local msg = table.concat(args, " ")
if #msg == 0 then
ch.send(unm, "no message was given")
return
end
ch.sayserver(msg)
end,
faketpa = function(unm, args) faketpa = function(unm, args)
local tgtplr = table.remove(args, 1) local tgtplr = table.remove(args, 1)
local sender = table.remove(args, 1) local sender = table.remove(args, 1)
@ -220,13 +241,13 @@ local function processMessage(unm, msg, hidden)
end end
end end
local function scheduleScan() -- local function scheduleScan()
os.startTimer(2) -- os.startTimer(2)
end -- end
local termStreak = 0 local termStreak = 0
local termStreakAt = 0 local termStreakAt = 0
local lastPlrList -- local lastPlrList
local listeners = { local listeners = {
["chat"] = function(username, message, uuid, isHidden) ["chat"] = function(username, message, uuid, isHidden)
return processMessage(username, message, isHidden) return processMessage(username, message, isHidden)
@ -240,22 +261,24 @@ local listeners = {
["playerLeave"] = function(username, dimension) ["playerLeave"] = function(username, dimension)
tk.plrs[username] = nil tk.plrs[username] = nil
end, end,
["timer"] = function() -- ["timer"] = function()
local plrs = tk:scanRange(16) -- scheduleScan()
table.sort(plrs)
local plrList = table.concat(plrs, ", ") -- local plrs = tk:scanRange(16)
if plrList ~= lastPlrList then -- table.sort(plrs)
if #plrs > 0 then
ch.reportLog("players in range: " .. plrList, "scan")
elseif lastPlrList ~= nil then
ch.reportLog("players left range", "scan")
end
lastPlrList = plrList -- local plrList = table.concat(plrs, ", ")
end -- if plrList ~= lastPlrList then
-- if #plrs > 0 then
-- ch.reportLog("players in range: " .. plrList, "scan")
-- elseif lastPlrList ~= nil then
-- ch.reportLog("players left range", "scan")
-- end
scheduleScan() -- lastPlrList = plrList
-- end
-- end,
["peripheral_detach"] = function()
end, end,
["terminate"] = function() ["terminate"] = function()
-- should we reset term streak -- should we reset term streak
@ -295,5 +318,4 @@ ch.userBc("Loaded!")
ch.reportLog("you are auto subbed to log, welcome!") ch.reportLog("you are auto subbed to log, welcome!")
tk:refresh() tk:refresh()
scheduleScan()
evDispatcher() evDispatcher()