From 6f2cc2fd8ea1ef4ae15e1c67c0f22241bab47f23 Mon Sep 17 00:00:00 2001 From: cora Date: Mon, 14 Nov 2022 20:41:18 +0100 Subject: [PATCH] some fixes --- abmp/init.lua | 3 +-- mdv_chatcommands/init.lua | 10 ++++++++++ mobtest/init.lua | 11 +++++++++-- mobtest/mod.conf | 1 + 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/abmp/init.lua b/abmp/init.lua index aa17a42..8f8f1d1 100644 --- a/abmp/init.lua +++ b/abmp/init.lua @@ -8,12 +8,11 @@ minetest.register_on_mods_loaded(function() for k,v in pairs(minetest.registered_abms) do local n=v.label local olda=v.action - max_times[n] = 0 minetest.registered_abms[k].action=function(pos, node, aoc, aocw) local t1=os.clock() local r=olda(pos, node, aoc, aocw) times[n]=os.clock()-t1 - if times[n] > max_times[n] then max_times[n] = times[n] end + if times[n] > ( max_times[n] or 0 ) then max_times[n] = times[n] end if not count[n] then count[n] = 0 end count[n]=count[n]+1 total=total+times[n] diff --git a/mdv_chatcommands/init.lua b/mdv_chatcommands/init.lua index 4895090..1723cb9 100644 --- a/mdv_chatcommands/init.lua +++ b/mdv_chatcommands/init.lua @@ -1,5 +1,15 @@ local S = minetest.get_translator("mcl_burning") + +minetest.register_chatcommand("mgflags", { + params = "", + description = "Get Mapgen flags", + privs = {debug = true}, + func = function(name) + minetest.chat_send_player(name,dump(minetest.get_mapgen_setting("mg_flags"))) + end +}) + minetest.register_chatcommand("biome", { params = "", description = "Gets current biome", diff --git a/mobtest/init.lua b/mobtest/init.lua index 8ec0766..3200904 100644 --- a/mobtest/init.lua +++ b/mobtest/init.lua @@ -6,9 +6,16 @@ minetest.register_chatcommand("mobtest",{ local p=minetest.get_player_by_name(n) local pos=p:get_pos() for k,v in pairs(minetest.registered_entities) do - if v.horny ~= nil then + if v.is_mob then local spos=vector.add(pos,vector.new(math.random(100)-50,0,math.random(100)-50)) - minetest.add_entity(spos, v.name) + local o = mcl_mobs.spawn(spos,v.name) + if o then + local l=o:get_luaentity() + if l and l.on_activate then + l.on_activate(l) + end + end + end end end}) diff --git a/mobtest/mod.conf b/mobtest/mod.conf index cf7f0fe..610d4d9 100644 --- a/mobtest/mod.conf +++ b/mobtest/mod.conf @@ -1 +1,2 @@ name = mobtest +depends = mcl_mobs