49 lines
1.2 KiB
Lua
49 lines
1.2 KiB
Lua
local dbg
|
|
if moddebug then dbg=moddebug.dbg("animals") else dbg={v1=function() end,v2=function() end,v3=function() end} end
|
|
|
|
animals.species["pig"] = {
|
|
|
|
shortdesc = "Pig",
|
|
|
|
mesh = "animals_pig.x",
|
|
textures = {"animals_pig.png"},
|
|
collisionbox = {-0.4, 0, -0.4, 0.4, 1, 0.4},
|
|
animations = {
|
|
stand = { x=25, y=75},
|
|
walk = { x=75, y=100},
|
|
},
|
|
|
|
sounds = {random="animals_pig"},
|
|
|
|
hp_max = 15,
|
|
catch_with = "animalmaterials:lasso",
|
|
maxspeed = 1,
|
|
|
|
-- These two are used to deal with model discrepancies, until I
|
|
-- can be arsed to fix the models.
|
|
yoffset = 0,
|
|
yawoffset = 0,
|
|
|
|
on_activate = function(ent)
|
|
end,
|
|
|
|
on_act = function(ent)
|
|
if math.random() < 0.3 then
|
|
local pos = ent.object:getpos()
|
|
local dist = math.random() * 5 + 5
|
|
local dir = math.random() * math.pi * 2
|
|
dbg.v3(ent.name.." decided to move " .. dist .. "m")
|
|
move = vector.from_speed_yaw(dist, dir)
|
|
pos.x = pos.x + move.x
|
|
pos.z = pos.z + move.z
|
|
return {"go", pos=pos}
|
|
end
|
|
return {"wait", time=5}
|
|
end,
|
|
|
|
on_hit = function(ent, playername)
|
|
end,
|
|
|
|
}
|
|
|