limit chat distance to 200 (avoid botspam)
parent
96e1896b08
commit
752329fb27
|
@ -458,9 +458,14 @@ end
|
|||
|
||||
aliveai.say=function(self,text)
|
||||
if self.talking==0 then return self end
|
||||
minetest.chat_send_all("<" .. self.botname .."> " .. text)
|
||||
local pos1=self.object:get_pos()
|
||||
aliveai.last_spoken_to=text
|
||||
aliveai.on_chat(self.object:get_pos(),self.botname,text)
|
||||
aliveai.on_chat(pos1,self.botname,text)
|
||||
for _,player in ipairs(minetest.get_connected_players()) do
|
||||
if aliveai.distance(pos1,player:get_pos())<aliveai.max_chat_distance then
|
||||
minetest.chat_send_player(player:get_player_name(), "<" .. self.botname .."> " .. text)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
aliveai.rndkey=function(a)
|
||||
|
|
|
@ -20,6 +20,7 @@ aliveai={
|
|||
max_delay=100, -- max run / bot delay
|
||||
lifetimer=60, --remove unbehavior none nps's
|
||||
max_new_bots=10,
|
||||
max_chat_distance=200,
|
||||
--========================not options==============================
|
||||
loaded_objects=0,
|
||||
delaytime=os.clock(),
|
||||
|
@ -90,7 +91,6 @@ end)
|
|||
aliveai.max_path_timer=0
|
||||
aliveai.max_path_delay=0
|
||||
|
||||
|
||||
aliveai.ticks_pers=os.clock()
|
||||
aliveai.game_paused=true
|
||||
|
||||
|
@ -128,4 +128,4 @@ dofile(minetest.get_modpath("aliveai") .. "/settings.lua")
|
|||
|
||||
aliveai.delaytime=(os.clock()-aliveai.delaytime)
|
||||
|
||||
print("[aliveai] api Loaded")
|
||||
print("[aliveai] api Loaded")
|
Loading…
Reference in New Issue