fix regression

master
root 2022-06-06 20:20:04 +02:00
parent 9de47d36bd
commit 68eb2bed09
6 changed files with 21 additions and 25 deletions

View File

@ -1,11 +1,9 @@
local _id = 0
function kitz.logon_mob(self)
_id = _id + 1
kitz.active_mobs[_id] = self.object
self._id = _id
table.insert(kitz.active_mobs, self.object)
end
function kitz.logout_mob(self)
kitz.active_mobs[self._id] = nil
kitz.active_mobs[self.object] = nil
end

View File

@ -582,7 +582,7 @@ function kitz.is_queue_empty_high(self)
else return false end
end
function kitz.get_nearby_player(self) -- returns random player if nearby or nil
function kitz.get_nearby_player(self) --returns random player if nearby or nil
local pos = self.object:get_pos()
local range = self.view_range * 0.5
for _, obj in ipairs(minetest.get_connected_players()) do
@ -597,9 +597,11 @@ function kitz.get_nearby_player(self) -- returns random player if nearby or nil
return
end
function kitz.get_nearby_entity(self,name) -- returns random nearby entity of name or nil
function kitz.get_nearby_entity(self, name) -- returns random nearby entity of name or nil
for _,obj in ipairs(kitz.active_mobs) do
if kitz.is_alive(obj) and obj:get_luaentity().name == name then return obj end
if not(self.object == obj) and kitz.is_alive(obj) and obj:get_luaentity().name == name then
return obj
end
end
return
end
@ -610,7 +612,7 @@ function kitz.get_closest_entity(self, name) --returns closest entity of name or
local pos = self.object:get_pos()
for _, obj in ipairs(kitz.active_mobs) do
local luaent = obj:get_luaentity()
if kitz.is_alive(obj) and luaent and luaent.name == name then
if not(self.object == obj) and kitz.is_alive(obj) and luaent and luaent.name == name then
local opos = obj:get_pos()
local odist = abs(opos.x-pos.x) + abs(opos.z-pos.z)
if odist < dist then
@ -801,7 +803,7 @@ function kitz.actfunc(self, staticdata, dtime_s)
self.lastvelocity = {x=0,y=0,z=0}
end
function kitz.stepfunc(self,dtime,colinfo) -- not intended to be modified
function kitz.stepfunc(self, dtime, colinfo) -- not intended to be modified
self.dtime = min(dtime,0.2)
self.colinfo = colinfo
self.height = kitz.get_box_height(self)
@ -827,22 +829,8 @@ function kitz.stepfunc(self,dtime,colinfo) -- not intended to be modified
end
self.lastvelocity = self.object:get_velocity()
self.time_total=self.time_total+self.dtime
self.time_total = self.time_total + self.dtime
end
-- load example behaviors
dofile(minetest.get_modpath("kitz") .. "/engine_behaviors.lua")
minetest.register_on_mods_loaded(function()
local mbkfuns = ''
for n,f in pairs(kitz) do
if type(f) == 'function' then
mbkfuns = mbkfuns .. n .. string.split(minetest.serialize(f),'.lua')[2] or ''
end
end
local crc = minetest.sha1(mbkfuns)
-- dbg(crc)
-- if crc ~= 'a061770008fe9ecf8e1042a227dc3beabd10e481' then
-- minetest.log("error","Mobkit namespace inconsistent, has been modified by other mods.")
-- end
end)

View File

@ -90,7 +90,7 @@ petz.on_rightclick = function(self, clicker)
else
minetest.chat_send_player(clicker:get_player_name(), S("This animal has already been milked."))
end
elseif (self.is_mountable) and (wielded_item_name == "petz:glass_syringe" or wielded_item_name == "petz:glass_syringe_sperm") then
elseif not(petz.settings.disable_syringe) and (self.is_mountable) and (wielded_item_name == "petz:glass_syringe" or wielded_item_name == "petz:glass_syringe_sperm") then
if not(self.is_baby) and is_owner then
petz.pony_breed(self, clicker, wielded_item, wielded_item_name)
end

View File

@ -11,7 +11,9 @@ function petz.bh_breed(self, pos)
local couple_obj = kitz.get_closest_entity(self, couple_name) -- look for a couple
if couple_obj then
local couple = couple_obj:get_luaentity()
minetest.chat_send_all(tostring(couple.is_male))
if couple and couple.is_rut and not(couple.is_pregnant) and not(couple.is_male) then --if couple and female and is not pregnant and is rut
local couple_pos = couple.object:get_pos() --get couple pos
local copulation_distance = petz.settings[self.type.."_copulation_distance"] or 1
if vector.distance(pos, couple_pos) <= copulation_distance then --if close

View File

@ -90,6 +90,7 @@ pregnancy_time = 300
growth_time = 1200
#Only owners can extract some seed from their ponies
seed_only_owners = true
disable_syringe = false
##Bloody Mode
blood = false
@ -307,6 +308,8 @@ pony_spawn_nodes = default:dirt_with_grass
pony_predators = petz:lion,petz:leopard
pony_spawn_biome = default
pony_spawn_herd = 5
pony_breed = default:blueberries
pony_copulation_distance = 3
##Parrot Specific
parrot_follow = farming:seed_wheat

View File

@ -261,6 +261,11 @@ local settings_def = {
type = "boolean",
default = true,
},
{
name = "disable_syringe",
type = "boolean",
default = false,
},
--Punch Effect
{
name = "colorize_punch",