Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- minetest.register_entity("zombiestrd:zombie",{
- -- common props
- physical = true,
- stepheight = 0.1,
- collide_with_objects = true,
- collisionbox = {-0.25, -1, -0.25, 0.25, 0.75, 0.25},
- visual = "mesh",
- mesh = "zombie_normal.b3d",
- textures = {"mobs_zombie.png","mobs_zombi2.png"},
- visual_size = {x = 1, y = 1},
- static_save = true,
- timeout = 600,
- on_step = mobkit.stepfunc, -- required
- on_activate = mobkit.actfunc, -- required
- get_staticdata = mobkit.statfunc,
- --CUSTOM PROPERTIES BELOW
- head = "zombiestrd:zombie_head",
- springiness=0,
- buoyancy = 0.75, -- portion of hitbox submerged
- max_speed = 3,
- jump_height = 1.26,
- view_range = 24,
- lung_capacity = 10, -- seconds
- max_hp = 14,
- attack={range=0.3,damage_groups={fleshy=7}},
- animation = {
- walk={range={x=41,y=101},speed=40,loop=true},
- stand={range={x=0,y=40},speed=1,loop=true},
- },
- sounds = {
- misc='zombie',
- attack='zombie_bite',
- warn = 'angrydog',
- headhit = 'splash_hit',
- bodyhit = 'body_hit',
- charge = 'zombie_charge',
- },
- armor_groups={immortal=100},
- brainfunc = zombie_brain,
- ...
- })
- function mobkit.actfunc(self, staticdata, dtime_s)
- self.logic = self.logic or self.brainfunc
- self.physics = self.physics or mobkit.physics
- self.lqueue = {}
- self.hqueue = {}
- self.nearby_objects = {}
- self.nearby_players = {}
- self.pos_history = {}
- self.path_dir = 1
- self.time_total = 0
- self.water_drag = self.water_drag or 1
- local name = self.name
- local head = self.object:get_properties().head
- if head then -- Returns false as get_properties() returns a table without 'head' prop
- local rel_pos = minetest.registered_entities[head].pos
- local pos = self.object:get_pos()
- local real_pos = {x = pos.x+rel_pos.x, y=pos.y+rel_pos.y, z=pos.z+rel_pos.z}
- local head_obj = minetest.add_entity(rel_pos, head)
- local rot = self.object:get_rotation()
- head_obj:set_attach(self, "", rel_pos, {x=deg(rot.x), y=deg(rot.y), z=deg(rot.z)})
- end
Advertisement
Add Comment
Please, Sign In to add comment