Creatures MOB-Engine API ------------------------ creatures.register_mob(#Creature definition) -registers a mob at MOB-Engine; returns true when sucessfull creatures.register_alias(old_mob, new_mob) -- returns true if sucessfull -registers an alias for other mob, e.g. from other mods or removed ones. existent entities (MOBs), Spawners and Spawn Eggs are converted; returns true when sucessfull ^ old_mob: name as string, e.g. "creatures:oerrki" ^ new_mob: name as string, e.g. "creatures:oerkki" ^ example: creatures.register_alias("creatures:oerrki", "creatures:oerkki") creatures.rnd(chance_table) -returns a weighted random table element; chance_sum of table must be 1 ^ example: creatures.rnd({elem1 = {chance = 0.7}, {elem2 = {chance = 0.3}}) creatures.compare_pos(pos1, pos2) -returns true if pos1 == pos2 creatures.findTarget(search_obj, pos, radius, search_type, mob_name, xray, no_count) -returns table of found objects (as ObjectRef) and boolean player_near ^ search_obj is searching object; can be nil ^ pos is starting position for search radius ^ radius for searching in blocks/node ^ search_type that specifies returned object requirements ^ "all" -- returns every object except dropped Items ^ "hostile" -- returns every object(creature) that has hostile setting or is player ^ ignores "mob_type" if specified ^ "nonhostile" -- returns every object that is not hostile or player ^ "player" -- returns all players ^ "mates" -- returns all objects(creatures) that are of same kind ^ requires "mob_type" specifies ^ mob_type specifies creature that is ignored or searched, depending on search_type ^ xray allows searching through blocks/nodes (default == false) ^ no_count skips collecting loop and returns just the boolean player_near ^ table is empty creatures.dropItems(pos, drops) -drops items at position pos ^ pos where to drop Items ^ drops table in #ItemDrops format #ItemDrops ---------- { { , -- e.g. "default:wood" , -- either a or table in format {min = , max = }; optional -- "chance = ": between 0.0 and 1.0 }, } Example: Will drop with a chance of 30% 1 to 3 items of type "default:wood" and with a chance of 100% 2 items of type "default:stone" { {"default:wood", {min = 1, max = 3}, chance = 0.3}, {"default:stone", 2} } #Creature definition -------------------- { name = "", -- e.g. "creatures:sheep" stats = { hp = 1, -- 1 HP = "1/2 player heart" hostile = false, -- is mob hostile (required for mode "attack") lifetime = 300, -- after which time mob despawns, in seconds dies_when_tamed = false, -- stop despawn when tamed can_jump = 1, -- height in nodes can_swim = false, -- can mob swim or will it drown can_fly = false, -- allows to fly (requires mode "fly") and disable step sounds can_burn = false, -- takes damage of lava can_panic = false, -- runs fast around when hit (requires mode "walk") has_falldamage = false, -- deals damage if falling more than 3 blocks has_kockback = false, -- get knocked back when hit sneaky = false, -- disables step sounds light = {min, max}, -- which light level will burn creature (requires can_burn = true) }, modes = { idle = {chance = , duration =