82 lines
2.8 KiB
Plaintext
82 lines
2.8 KiB
Plaintext
examobs.register_mob({
|
|
name = "name", -- name
|
|
type = "npc", -- mob type
|
|
dmg = 1, -- punching damage
|
|
aggressivity = 1, -- -2 to 2, -2: flee from everything, -1: flee from monsters, 0: no reaction, 1: fight monsters, 2: fight everything
|
|
walk_speed = 4,
|
|
run_speed = 8,
|
|
hp = 20 -- health
|
|
physical = true
|
|
collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}
|
|
visual = "mesh"
|
|
visual_size = {x=1,y=1}
|
|
mesh = "character.b3d"
|
|
makes_footstep_sound = true
|
|
lay_on_death = -- 0/1 (off/on)
|
|
textures = {"character.png"}
|
|
team = "default"
|
|
range = 15 -- view range
|
|
reach = 4 -- can reach & punch
|
|
punch_chance = 5
|
|
bottom = 0 -- checking nodes from here (pos.y+bottom)
|
|
breathing = 1 -- 0/1 (breathing as fishes/drowning)
|
|
resist_nodes = {} -- {["default:lava_source"]=1,["fire:basic_flame"]=true}
|
|
swiming = 1 -- 0/1 (swiming/drowning while it is in water, as an deathtrap)
|
|
inv = {} -- inventory/drops {["default:stick"]=2,["default:dirt"]=89}
|
|
flee_from_threats_only = 0 -- 1/0 (off/on)
|
|
floating = {} -- {["default:water_source"]=1,["default:gass"]=true}
|
|
floating_in_group = -- alternative to above, "water"
|
|
updatetime = 1 -- run/cycle time
|
|
spawn_chance = 100,
|
|
spawn_on = {"group:dirt","group:sand"}
|
|
spawn_in = -- node or group-name
|
|
light_min = 9
|
|
light_max = 15
|
|
lifetime = 300 -- before its removed
|
|
add_wear = 10000 -- adds tool wear
|
|
|
|
animation = "default" -- or {stand={x=1,y=39},walk={x=41,y=61,},run={x=41,y=61,speed=60},attack={x=65,y=75},lay={x=113,y=123}}
|
|
|
|
step = function(self) -- on_step
|
|
on_dying = function(self)
|
|
death = function(self)
|
|
on_punched = function(self,puncher)
|
|
on_punching = function(self)
|
|
before_punching = function(self)
|
|
on_spawn = function(self)
|
|
on_load = function(self)
|
|
is_food = function(self,item_string) -- return true to use item as food
|
|
on_lifedeadline = function(self) -- runned while mob lifetime expended, return true to reset it
|
|
on_walk = function(self,x,y,z)
|
|
on_fly = function(self,x,y,z)
|
|
on_stand = function(self)
|
|
on_click = function(self,clicker)
|
|
})
|
|
|
|
examobs.register_bird(def) -- as to above, adapted for birds
|
|
examobs.register_fish(def) -- fish
|
|
|
|
self:eat_item(self,item,nil or hp)
|
|
self:heal(self,hp,gaps,num)
|
|
self:pos() -- return self.object:get_pos()
|
|
self:hurt(dmg)
|
|
|
|
examobs.jump(self)
|
|
examobs.stand(self)
|
|
examobs.walk(self,run)
|
|
examobs.lookat(self,pos)
|
|
examobs.anim(self,type)
|
|
examobs.num(a) --check number
|
|
examobs.team(object)
|
|
examobs.known(self,object,type,get)
|
|
examobs.visiable(pos1,pos2)
|
|
examobs.gethp(ob,even_dead)
|
|
examobs.viewfield(self,ob2)
|
|
examobs.faceside(self,ob)
|
|
examobs.pointat(self,d)
|
|
examobs.distance(pos1,pos2)
|
|
examobs.punch(puncher,target,damage)
|
|
examobs.showtext(self,text,color)
|
|
examobs.dropall(self)
|
|
examobs.dying(self,set)
|
|
walkable(pos) |