From 87ab8787a6887ed4d99010c4aeb6d635c169dd0a Mon Sep 17 00:00:00 2001 From: BlockMen Date: Thu, 8 Oct 2015 16:59:54 +0200 Subject: [PATCH] Complete rewrite and rename to Creatures MOB-Engine --- API.txt | 188 + README.txt | 129 +- creatures/LICENSE.txt | 20 + creatures/README.txt | 121 + creatures/common.lua | 148 + depends.txt => creatures/depends.txt | 0 creatures/description.txt | 1 + creatures/functions.lua | 644 ++ creatures/init.lua | 33 + creatures/items.lua | 39 + creatures/register.lua | 574 ++ screenshot.png => creatures/screenshot.png | Bin creatures/sounds/creatures_splash.1.ogg | Bin 0 -> 8391 bytes creatures/sounds/creatures_splash.2.ogg | Bin 0 -> 8844 bytes creatures/textures/creatures_flesh.png | Bin 0 -> 441 bytes creatures/textures/creatures_meat.png | Bin 0 -> 478 bytes creatures/textures/creatures_spawn_egg.png | Bin 0 -> 686 bytes .../textures}/creatures_spawner.png | Bin description.txt | 1 - ghost.lua | 290 - init.lua | 209 - items.lua | 91 - models/creatures_ghost.png | Bin 1956 -> 0 bytes models/creatures_mob.x | 5524 -------------- models/creatures_sheep.png | Bin 2032 -> 0 bytes models/creatures_sheep.x | 6751 ----------------- models/creatures_sheep_shaved.png | Bin 2657 -> 0 bytes models/creatures_zombie.png | Bin 3223 -> 0 bytes modpack.txt | 0 sheep.lua | 394 - sounds/creatures_ghost.1.ogg | Bin 28792 -> 0 bytes sounds/creatures_ghost.2.ogg | Bin 22828 -> 0 bytes sounds/creatures_ghost_death.ogg | Bin 14526 -> 0 bytes sounds/creatures_ghost_hit.ogg | Bin 11312 -> 0 bytes sounds/creatures_shears.ogg | Bin 7145 -> 0 bytes sounds/creatures_sheep.1.ogg | Bin 15806 -> 0 bytes sounds/creatures_sheep.2.ogg | Bin 11642 -> 0 bytes sounds/creatures_sheep.3.ogg | Bin 18857 -> 0 bytes sounds/creatures_zombie.1.ogg | Bin 15897 -> 0 bytes sounds/creatures_zombie.2.ogg | Bin 17475 -> 0 bytes sounds/creatures_zombie.3.ogg | Bin 25164 -> 0 bytes sounds/creatures_zombie_death.ogg | Bin 19970 -> 0 bytes sounds/creatures_zombie_hit.ogg | Bin 6929 -> 0 bytes spawn.lua | 101 - spawners.lua | 94 - textures/creatures_egg_ghost.png | Bin 718 -> 0 bytes textures/creatures_egg_sheep.png | Bin 675 -> 0 bytes textures/creatures_egg_zombie.png | Bin 714 -> 0 bytes textures/creatures_flesh.png | Bin 351 -> 0 bytes textures/creatures_meat.png | Bin 404 -> 0 bytes textures/creatures_rotten_flesh.png | Bin 433 -> 0 bytes textures/creatures_shears.png | Bin 282 -> 0 bytes zombie.lua | 340 - 53 files changed, 1790 insertions(+), 13902 deletions(-) create mode 100644 API.txt create mode 100644 creatures/LICENSE.txt create mode 100644 creatures/README.txt create mode 100644 creatures/common.lua rename depends.txt => creatures/depends.txt (100%) create mode 100644 creatures/description.txt create mode 100644 creatures/functions.lua create mode 100644 creatures/init.lua create mode 100644 creatures/items.lua create mode 100644 creatures/register.lua rename screenshot.png => creatures/screenshot.png (100%) create mode 100644 creatures/sounds/creatures_splash.1.ogg create mode 100644 creatures/sounds/creatures_splash.2.ogg create mode 100644 creatures/textures/creatures_flesh.png create mode 100644 creatures/textures/creatures_meat.png create mode 100644 creatures/textures/creatures_spawn_egg.png rename {textures => creatures/textures}/creatures_spawner.png (100%) delete mode 100644 description.txt delete mode 100644 ghost.lua delete mode 100644 init.lua delete mode 100644 items.lua delete mode 100644 models/creatures_ghost.png delete mode 100644 models/creatures_mob.x delete mode 100644 models/creatures_sheep.png delete mode 100644 models/creatures_sheep.x delete mode 100644 models/creatures_sheep_shaved.png delete mode 100644 models/creatures_zombie.png create mode 100644 modpack.txt delete mode 100644 sheep.lua delete mode 100644 sounds/creatures_ghost.1.ogg delete mode 100644 sounds/creatures_ghost.2.ogg delete mode 100644 sounds/creatures_ghost_death.ogg delete mode 100644 sounds/creatures_ghost_hit.ogg delete mode 100644 sounds/creatures_shears.ogg delete mode 100644 sounds/creatures_sheep.1.ogg delete mode 100644 sounds/creatures_sheep.2.ogg delete mode 100644 sounds/creatures_sheep.3.ogg delete mode 100644 sounds/creatures_zombie.1.ogg delete mode 100644 sounds/creatures_zombie.2.ogg delete mode 100644 sounds/creatures_zombie.3.ogg delete mode 100644 sounds/creatures_zombie_death.ogg delete mode 100644 sounds/creatures_zombie_hit.ogg delete mode 100644 spawn.lua delete mode 100644 spawners.lua delete mode 100644 textures/creatures_egg_ghost.png delete mode 100644 textures/creatures_egg_sheep.png delete mode 100644 textures/creatures_egg_zombie.png delete mode 100644 textures/creatures_flesh.png delete mode 100644 textures/creatures_meat.png delete mode 100644 textures/creatures_rotten_flesh.png delete mode 100644 textures/creatures_shears.png delete mode 100644 zombie.lua diff --git a/API.txt b/API.txt new file mode 100644 index 0000000..20297c1 --- /dev/null +++ b/API.txt @@ -0,0 +1,188 @@ +Creatures MOB-Engine API +------------------------ + +creatures.register_mob(#Creature definition) + -registers a mob at MOB-Engine; returns true when sucessfull + +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 =