add bio data to api
This commit is contained in:
parent
61e319806c
commit
7f64981599
@ -170,7 +170,7 @@ minetest.register_entity("water_life:coralfish_tamed",{
|
||||
swarm = {},
|
||||
base = nil,
|
||||
head = 65535,
|
||||
owner = "",
|
||||
owner = "",
|
||||
drops = {},
|
||||
-- {name = "default:diamond", chance = 20, min = 1, max = 1,},
|
||||
-- {name = "water_life:meat_raw", chance = 2, min = 1, max = 1,},
|
||||
|
107
bio.lua
Normal file
107
bio.lua
Normal file
@ -0,0 +1,107 @@
|
||||
|
||||
local abs = math.abs
|
||||
local pi = math.pi
|
||||
local floor = math.floor
|
||||
local ceil = math.ceil
|
||||
local sqrt = math.sqrt
|
||||
local max = math.max
|
||||
local min = math.min
|
||||
local pow = math.pow
|
||||
local sign = math.sign
|
||||
local time = os.clock
|
||||
local rad = math.rad
|
||||
local random = water_life.random
|
||||
local deg=math.deg
|
||||
local tan = math.tan
|
||||
local cos = math.cos
|
||||
local atan=math.atan
|
||||
|
||||
|
||||
function water_life.init_bio(self)
|
||||
mobkit.remember(self,"wl_hunger",100)
|
||||
mobkit.remember(self,"wl_exhaust",100)
|
||||
mobkit.remember(self,"wl_horny",100)
|
||||
mobkit.remember(self,"wl_pregnant",-1)
|
||||
mobkit.remember(self,"wl_head",random(65535))
|
||||
mobkit.remember(self,"wl_headpos", nil)
|
||||
mobkit.remember(self,"wl_boss", 0)
|
||||
end
|
||||
|
||||
|
||||
function water_life.is_boss(self,change)
|
||||
if not self then return 0 end
|
||||
if not change then return mobkit.recall(self,"wl_boss") or 0 end
|
||||
mobkit.remember(self,"wl_boss", change)
|
||||
end
|
||||
|
||||
|
||||
function water_life.headpos(self,change)
|
||||
if not self then return nil end
|
||||
if not change then
|
||||
local strg = mobkit.recall(self,"wl_headpos")
|
||||
if strg then
|
||||
return minetest.deserialize(strg)
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
mobkit.remember(self,"wl_headpos", minetest.serialize(change))
|
||||
end
|
||||
|
||||
|
||||
function water_life.head(self)
|
||||
if not self then return 0 end
|
||||
local boss = mobkit.recall(self,"wl_head")
|
||||
if boss then
|
||||
return boss
|
||||
else
|
||||
boss = random(65535)
|
||||
mobkit.remember(self,"wl_head",boss)
|
||||
return boss
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function water_life.hunger(self,change)
|
||||
if not self then return 0 end
|
||||
if not change then change = 0 end
|
||||
local hunger = mobkit.recall(self,"wl_hunger") or 100
|
||||
hunger = hunger + change
|
||||
if hunger < 0 then hunger = 0 end
|
||||
if hunger > 100 then hunger = 100 end
|
||||
mobkit.remember(self,"wl_hunger", hunger)
|
||||
return hunger
|
||||
end
|
||||
|
||||
|
||||
function water_life.exhaust(self,change)
|
||||
if not self then return 0 end
|
||||
if not change then change = 0 end
|
||||
local exhaust = mobkit.recall(self,"wl_exhaust") or 100
|
||||
exhaust = exhaust + change
|
||||
if exhaust < 0 then exhaust = 0 end
|
||||
if exhaust > 100 then exhaust = 100 end
|
||||
mobkit.remember(self,"wl_exhaust", exhaust)
|
||||
return exhaust
|
||||
end
|
||||
|
||||
|
||||
function water_life.horny(self,change)
|
||||
if not self then return 0 end
|
||||
if not change then change = 0 end
|
||||
local horny = mobkit.recall(self,"wl_horny") or 100
|
||||
horny = horny + change
|
||||
if horny < 0 then horny = 0 end
|
||||
if horny > 100 then horny = 100 end
|
||||
mobkit.remember(self,"wl_horny", horny)
|
||||
return horny
|
||||
end
|
||||
|
||||
|
||||
function water_life.pregnant(self,change)
|
||||
if not self then return -1 end
|
||||
if not change then return mobkit.recall(self,"wl_pregnant") or -1 end
|
||||
|
||||
mobkit.remember(self,"wl_pregnant", change)
|
||||
end
|
3
init.lua
3
init.lua
@ -6,7 +6,7 @@
|
||||
-----------------------------------------------------------
|
||||
|
||||
water_life = {}
|
||||
water_life.version = "221120"
|
||||
water_life.version = "291120"
|
||||
water_life.shark_food = {}
|
||||
water_life.repellant = {}
|
||||
water_life.petz = minetest.get_modpath("petz")
|
||||
@ -42,6 +42,7 @@ dofile(path.."/crafts.lua") -- load crafts
|
||||
dofile(path.."/buoy.lua") -- load buoy
|
||||
dofile(path.."/chatcommands.lua") -- load chatcommands
|
||||
dofile(path.."/behaviors.lua") -- load behaviors
|
||||
dofile(path.."/bio.lua") -- load bio
|
||||
|
||||
if not water_life.apionly then
|
||||
dofile(path.."/hud.lua") -- load player hud
|
||||
|
Loading…
x
Reference in New Issue
Block a user