Compare commits
5 Commits
5cc9f4b0bb
...
1694be3f32
Author | SHA1 | Date |
---|---|---|
BlockMen | 1694be3f32 | |
BlockMen | e3502a1c81 | |
BlockMen | 4096344c6f | |
BlockMen | ac569c49a9 | |
BlockMen | a11ca58729 |
8
API.txt
|
@ -4,6 +4,14 @@ 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}})
|
||||
|
|
10
README.txt
|
@ -1,22 +1,22 @@
|
|||
Mod/Modpack Creatures
|
||||
=====================
|
||||
Copyright (c) 2015 BlockMen <blockmen2015@gmail.com>
|
||||
Copyright (c) 2015-2016 BlockMen <blockmen2015@gmail.com>
|
||||
|
||||
Version: 2.2.2
|
||||
Version: 2.3.1
|
||||
|
||||
|
||||
A Mod(pack) for Minetest that provides a MOB-Engine and adds several creatures to the game.
|
||||
Currently included: Ghosts, Zombies, Sheep and Chicken.
|
||||
Currently included: Ghosts, Zombies, Sheep, Chicken and Oerrki.
|
||||
|
||||
|
||||
License:
|
||||
~~~~~~~~
|
||||
Code(if not stated differently):
|
||||
(c) Copyright 2015 BlockMen; modified zlib-License
|
||||
(c) Copyright 2015-2016 BlockMen; modified zlib-License
|
||||
see "LICENSE.txt" for details.
|
||||
|
||||
Media(if not stated differently):
|
||||
(c) Copyright (2014-2015) BlockMen; CC-BY-SA 3.0
|
||||
(c) Copyright (2014-2016) BlockMen; CC-BY-SA 3.0
|
||||
|
||||
see each MOB-Module for detailed informations.
|
||||
|
||||
|
|
|
@ -24,3 +24,17 @@ Version 2.2.2
|
|||
- Chicken drop chicken meat and feather(s) on death
|
||||
- Fixed spawn eggs being endless in singleplayer
|
||||
- Fix searching for target if in panic mode
|
||||
|
||||
Version 2.3
|
||||
-----------
|
||||
- Added Oerrki
|
||||
- Added fried eggs
|
||||
- Fixed moveing facement being reset
|
||||
- Fixed chicken model
|
||||
- Fixed sneaky variable not working
|
||||
- Fixed feathers being eatable
|
||||
|
||||
Version 2.3.1
|
||||
-------------
|
||||
- Added colored sheep
|
||||
- Fixed Oerrki spawning times (spawns on night as intended)
|
||||
|
|
|
@ -2,13 +2,14 @@ Chicken for Creatures MOB-Engine
|
|||
================================
|
||||
Copyright (c) 2015-2016 BlockMen <blockmen2015@gmail.com>
|
||||
|
||||
Version: 2.2
|
||||
Version: 2.3
|
||||
|
||||
|
||||
Adds chicken to Minetest (requires Creatures MOB-Engine).
|
||||
Chicken spawn on dirt and grass blocks, have 5 HP and are friendly. When killed or dying
|
||||
they drop meat, which can be eaten or cooked and probably some feathers. Also they drop
|
||||
randomly eggs, which can be thrown to spawn new chicken or fried and eaten.
|
||||
randomly eggs, which can be thrown to spawn new chicken or fried and eaten. They appear
|
||||
with white or brown feathers.
|
||||
|
||||
|
||||
License:
|
||||
|
|
|
@ -55,6 +55,12 @@ core.register_craftitem(":creatures:feather", {
|
|||
inventory_image = "creatures_feather.png",
|
||||
})
|
||||
|
||||
|
||||
local colors = {
|
||||
white = {chance = 0.7},
|
||||
brown = {chance = 0.3}
|
||||
}
|
||||
|
||||
local def = {
|
||||
-- general
|
||||
name = "creatures:chicken",
|
||||
|
@ -74,14 +80,14 @@ local def = {
|
|||
idle2 = {chance = 0.69, duration = 0.8},
|
||||
pick = {chance = 0.2, duration = 2},
|
||||
walk = {chance = 0.2, duration = 5.5, moving_speed = 0.7, update_yaw = 2},
|
||||
panic = {moving_speed = 2.1},
|
||||
panic = {moving_speed = 3.1, update_yaw = 0.8},
|
||||
lay_egg = {chance = 0.01, duration = 1},
|
||||
},
|
||||
|
||||
model = {
|
||||
mesh = "creatures_chicken.b3d",
|
||||
textures = {"creatures_chicken.png"},
|
||||
collisionbox = {-0.25, -0.01, -0.3, 0.25, 0.45, 0.3},
|
||||
textures = {"creatures_chicken_white.png"},
|
||||
collisionbox = {-0.19, -0.01, -0.19, 0.19, 0.52, 0.19},
|
||||
rotation = 90.0,
|
||||
collide_with_objects = false,
|
||||
animations = {
|
||||
|
@ -126,6 +132,20 @@ local def = {
|
|||
{"creatures:feather", {min = 1, max = 2}, chance = 0.45},
|
||||
},
|
||||
|
||||
get_staticdata = function(self)
|
||||
return {
|
||||
feather_color = self.feather_color,
|
||||
}
|
||||
end,
|
||||
|
||||
on_activate = function(self, staticdata)
|
||||
if not self.feather_color then
|
||||
self.feather_color = creatures.rnd(colors) or "white"
|
||||
end
|
||||
-- update feather color
|
||||
self.object:set_properties({textures = {"creatures_chicken_" .. self.feather_color .. ".png"}})
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
if self.mode == "lay_egg" then
|
||||
dropEgg(self.object)
|
||||
|
|
After Width: | Height: | Size: 708 B |
After Width: | Height: | Size: 710 B |
|
@ -25,7 +25,15 @@ nullVec = {x = 0, y = 0, z = 0}
|
|||
DEGTORAD = math.pi / 180.0
|
||||
|
||||
-- common functions
|
||||
function creatures.rnd(table, errval)
|
||||
function creatures.sumChances(tab)
|
||||
local psum = 0
|
||||
for s,w in pairs(tab) do
|
||||
psum = psum + ((tonumber(w) or w.chance or 0))
|
||||
end
|
||||
return psum
|
||||
end
|
||||
|
||||
function creatures.rnd(tab, errval)
|
||||
if not errval then
|
||||
errval = false
|
||||
end
|
||||
|
@ -35,7 +43,7 @@ function creatures.rnd(table, errval)
|
|||
local retval = nil
|
||||
|
||||
local psum = 0
|
||||
for s,w in pairs(table) do
|
||||
for s,w in pairs(tab) do
|
||||
psum = psum + ((tonumber(w) or w.chance or 0) * res)
|
||||
if psum > rn then
|
||||
retval = s
|
||||
|
@ -50,6 +58,10 @@ function throw_error(msg)
|
|||
core.log("error", "#Creatures: ERROR: " .. msg)
|
||||
end
|
||||
|
||||
function throw_warning(msg)
|
||||
core.log("warning", "#Creatures: WARNING: " .. msg)
|
||||
end
|
||||
|
||||
function creatures.compare_pos(pos1, pos2)
|
||||
if not pos1 or not pos2 then
|
||||
return
|
||||
|
|
|
@ -53,6 +53,18 @@ local function translate_def(def)
|
|||
--if name == "attack" then new_def.modes[name].chance = 0 end
|
||||
end
|
||||
end
|
||||
|
||||
-- Check if the modes have correct sum
|
||||
local mode_chance_sum = creatures.sumChances(new_def.modes)
|
||||
if mode_chance_sum > 1 then
|
||||
throw_warning("Chance of modes too high for MOB: " .. def.name ..
|
||||
". Mode chances will be incorrect.")
|
||||
elseif mode_chance_sum < 1 then
|
||||
throw_warning("Chance of modes too low for MOB: " .. def.name ..
|
||||
". Filling up to correct mode chances.")
|
||||
new_def.modes["_empty"] = {chance = 1 - mode_chance_sum, duration = 0}
|
||||
end
|
||||
|
||||
-- insert special mode "_run" which is used when in panic
|
||||
if def.stats.can_panic then
|
||||
if def.modes.walk then
|
||||
|
@ -578,3 +590,46 @@ function creatures.register_spawner(spawner_def)
|
|||
|
||||
return true
|
||||
end
|
||||
|
||||
local function register_alias_entity(old_mob, new_mob)
|
||||
core.register_entity(":" .. old_mob, {
|
||||
physical = false,
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
visual = "sprite",
|
||||
visual_size = {x = 0, y = 0},
|
||||
textures = {"creatures_spawner.png"}, -- dummy texture
|
||||
makes_footstep_sound = false,
|
||||
|
||||
on_activate = function(self)
|
||||
local pos = self.object:getpos()
|
||||
if pos then
|
||||
core.add_entity(pos, new_mob)
|
||||
end
|
||||
if self.object then
|
||||
self.object:remove()
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
function creatures.register_alias(old_mob, new_mob) -- returns true if sucessfull
|
||||
local def = core.registered_entities[new_mob]
|
||||
if not def then
|
||||
throw_error("No valid definition for given.")
|
||||
return false
|
||||
end
|
||||
|
||||
register_alias_entity(old_mob, new_mob)
|
||||
|
||||
if core.registered_nodes[new_mob .. "_spawner"] then
|
||||
register_alias_entity(old_mob .. "_spawner_dummy", new_mob .. "_spawner_dummy")
|
||||
core.register_alias(old_mob .. "_spawner", new_mob .. "_spawner")
|
||||
end
|
||||
|
||||
if core.registered_items[new_mob .. "_spawn_egg"] then
|
||||
core.register_alias(old_mob .. "_spawn_egg", new_mob .. "_spawn_egg")
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
|
|
@ -45,7 +45,7 @@ local def = {
|
|||
model = {
|
||||
mesh = "creatures_ghost.b3d",
|
||||
textures = {"creatures_ghost.png"},
|
||||
collisionbox = {-0.25, 0, -0.3, 0.25, 1.3, 0.3},
|
||||
collisionbox = {-0.22, 0, -0.22, 0.22, 1.2, 0.22},
|
||||
rotation = -90.0,
|
||||
animations = {
|
||||
idle = {start = 0, stop = 80, speed = 15},
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
Oerrki for Creatures MOB-Engine
|
||||
Oerkki for Creatures MOB-Engine
|
||||
===============================
|
||||
Copyright (c) 2016 BlockMen <blockmen2015@gmail.com>
|
||||
|
||||
Version: 1.0 Beta
|
||||
|
||||
|
||||
Adds classic Minetest Ghost called "Oerrki". (requires Creatures MOB-Engine).
|
||||
Oerrki spawn only at night or in dark places and remain around 5 minutes in the world.
|
||||
Adds classic Minetest Ghost called "Oerkki". (requires Creatures MOB-Engine).
|
||||
Oerkki spawn only at night or in dark places and remain around 5 minutes in the world.
|
||||
Other than Ghosts or Zombies they don't die by sunlight.
|
||||
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
default
|
||||
creatures
|
||||
|
||||
oerrki?
|
|
@ -1,4 +1,4 @@
|
|||
--= Oerrki for Creatures MOB-Engine (cme) =--
|
||||
--= Oerkki for Creatures MOB-Engine (cme) =--
|
||||
-- Copyright (c) 2016 BlockMen <blockmen2015@gmail.com>
|
||||
--
|
||||
-- init.lua
|
||||
|
@ -21,7 +21,7 @@
|
|||
|
||||
|
||||
local def = {
|
||||
name = "creatures:oerrki",
|
||||
name = "creatures:oerkki",
|
||||
stats = {
|
||||
hp = 13,
|
||||
lifetime = 540, -- 9 Minutes
|
||||
|
@ -36,9 +36,9 @@ local def = {
|
|||
},
|
||||
|
||||
model = {
|
||||
mesh = "creatures_oerrki.b3d",
|
||||
textures = {"creatures_oerrki.png"},
|
||||
collisionbox = {-0.25, -0.01, -0.3, 0.25, 1.75, 0.3},
|
||||
mesh = "creatures_oerkki.b3d",
|
||||
textures = {"creatures_oerkki.png"},
|
||||
collisionbox = {-0.22, -0.01, -0.22, 0.22, 1.65, 0.22},
|
||||
rotation = -90.0,
|
||||
animations = {
|
||||
idle = {start = 1, stop = 23, speed = 15},
|
||||
|
@ -50,12 +50,12 @@ local def = {
|
|||
},
|
||||
|
||||
sounds = {
|
||||
on_damage = {name = "creatures_oerrki_hit", gain = 1.0, distance = 10},
|
||||
on_death = {name = "creatures_oerrki_hit", gain = 1.0, distance = 10},
|
||||
on_damage = {name = "creatures_oerkki_hit", gain = 1.0, distance = 10},
|
||||
on_death = {name = "creatures_oerkki_hit", gain = 1.0, distance = 10},
|
||||
swim = {name = "creatures_splash", gain = 1.0, distance = 10},
|
||||
random = {
|
||||
idle = {name = "creatures_oerrki_idle", gain = 1.0, distance = 25},
|
||||
attack = {name = "creatures_oerrki_attack", gain = 1.0, distance = 20},
|
||||
idle = {name = "creatures_oerkki_idle", gain = 1.0, distance = 25},
|
||||
attack = {name = "creatures_oerkki_attack", gain = 1.0, distance = 20},
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -88,17 +88,17 @@ local def = {
|
|||
abm_chance = 7800,
|
||||
max_number = 1,
|
||||
number = {min = 1, max = 3},
|
||||
time_range = {min = 5100, max = 18300},
|
||||
time_range = {min = 18500, max = 5100},
|
||||
light = {min = 0, max = 8},
|
||||
height_limit = {min = -200, max = 50},
|
||||
|
||||
spawn_egg = {
|
||||
description = "Oerrki Spawn-Egg",
|
||||
texture = "creatures_egg_oerrki.png",
|
||||
description = "Oerkki Spawn-Egg",
|
||||
texture = "creatures_egg_oerkki.png",
|
||||
},
|
||||
|
||||
spawner = {
|
||||
description = "Oerrki Spawner",
|
||||
description = "Oerkki Spawner",
|
||||
range = 8,
|
||||
player_range = 20,
|
||||
number = 6,
|
||||
|
@ -108,3 +108,6 @@ local def = {
|
|||
}
|
||||
|
||||
creatures.register_mob(def)
|
||||
|
||||
-- Convert "Oerrki's" (caused by typo)
|
||||
creatures.register_alias("creatures:oerrki", "creatures:oerkki")
|
Before Width: | Height: | Size: 695 B After Width: | Height: | Size: 695 B |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
@ -1,12 +1,13 @@
|
|||
Sheep for Creatures MOB-Engine
|
||||
==============================
|
||||
Copyright (c) 2015 BlockMen <blockmen2015@gmail.com>
|
||||
Copyright (c) 2015-2016 BlockMen <blockmen2015@gmail.com>
|
||||
|
||||
Version: 2.0 Beta
|
||||
Version: 2.1
|
||||
|
||||
|
||||
Adds sheep to Minetest (requires Creatures MOB-Engine).
|
||||
Sheep spawn only at day-time and are friendly and remain around 5 minutes in the world.
|
||||
There are four different wool colors: white, grey, brown and black.
|
||||
You can tame them by feading them with wheat. If there is grass they eat the grass
|
||||
and regrow wool that way. They will follow you if you have Wheat in your hand.
|
||||
Sheep have 8 HP and drop 1-2 wool when punched or 1-3 wool when using shears.
|
||||
|
@ -20,11 +21,11 @@ ingot stick
|
|||
License:
|
||||
~~~~~~~~
|
||||
Code:
|
||||
(c) Copyright 2015 BlockMen; modified zlib-License
|
||||
(c) Copyright 2015-2016 BlockMen; modified zlib-License
|
||||
see "LICENSE.txt" for details.
|
||||
|
||||
Media(textures and meshes/models):
|
||||
(c) Copyright (2014-2015) BlockMen; CC-BY-SA 3.0
|
||||
(c) Copyright (2014-2016) BlockMen; CC-BY-SA 3.0
|
||||
|
||||
Sounds:
|
||||
- creatures_sheep.1.ogg, confusion_music(https://freesound.org/people/confusion_music) CC-BY 3.0
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--= Sheep for Creatures MOB-Engine (cme) =--
|
||||
-- Copyright (c) 2015 BlockMen <blockmen2015@gmail.com>
|
||||
-- Copyright (c) 2015-2016 BlockMen <blockmen2015@gmail.com>
|
||||
--
|
||||
-- init.lua
|
||||
--
|
||||
|
@ -34,19 +34,39 @@ core.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
|
||||
local function setColor(self)
|
||||
if self and self.object then
|
||||
local ext = ".png"
|
||||
if self.has_wool ~= true then
|
||||
ext = ".png^(creatures_sheep_shaved.png^[colorize:" .. self.wool_color:gsub("grey", "gray") .. ":50)"
|
||||
end
|
||||
self.object:set_properties({textures = {"creatures_sheep.png^creatures_sheep_" .. self.wool_color .. ext}})
|
||||
end
|
||||
end
|
||||
|
||||
local function shear(self, drop_count, sound)
|
||||
if self.has_wool == true then
|
||||
self.has_wool = false
|
||||
local pos = self.object:getpos()
|
||||
|
||||
if sound then
|
||||
core.sound_play("creatures_shears", {pos = pos, gain = 1, max_hear_distance = 10})
|
||||
end
|
||||
self.object:set_properties({textures = {"creatures_sheep.png"}})
|
||||
creatures.dropItems(pos, {{"wool:white", drop_count}})
|
||||
|
||||
setColor(self)
|
||||
creatures.dropItems(pos, {{"wool:" .. self.wool_color, drop_count}})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- white, grey, brown, black (see wool colors as reference)
|
||||
local colors = {
|
||||
white = {chance = 0.7},
|
||||
grey = {chance = 0.1},
|
||||
brown = {chance = 0.1},
|
||||
black = {chance = 0.1}
|
||||
}
|
||||
|
||||
local def = {
|
||||
name = "creatures:sheep",
|
||||
stats = {
|
||||
|
@ -63,7 +83,7 @@ local def = {
|
|||
model = {
|
||||
mesh = "creatures_sheep.b3d",
|
||||
textures = {"creatures_sheep.png^creatures_sheep_white.png"},
|
||||
collisionbox = {-0.5, -0.01, -0.55, 0.5, 1.1, 0.55},
|
||||
collisionbox = {-0.45, -0.01, -0.45, 0.45, 1.06, 0.45},
|
||||
rotation = -90.0,
|
||||
animations = {
|
||||
idle = {start = 1, stop = 60, speed = 15},
|
||||
|
@ -90,7 +110,7 @@ local def = {
|
|||
walk_long = {chance = 0.11, duration = 8, moving_speed = 1.3, update_yaw = 5},
|
||||
-- special modes
|
||||
follow = {chance = 0, duration = 20, radius = 4, timer = 5, moving_speed = 1, items = {"farming:wheat"}},
|
||||
eat = {chance = 0.25,
|
||||
eat = { chance = 0.25,
|
||||
duration = 4,
|
||||
nodes = {
|
||||
"default:grass_1", "default:grass_2", "default:grass_3",
|
||||
|
@ -102,7 +122,7 @@ local def = {
|
|||
drops = function(self)
|
||||
local items = {{"creatures:flesh"}}
|
||||
if self.has_wool then
|
||||
table.insert(items, {"wool:white", {min = 1, max = 2}})
|
||||
table.insert(items, {"wool:" .. self.wool_color, {min = 1, max = 2}})
|
||||
end
|
||||
creatures.dropItems(self.object:getpos(), items)
|
||||
end,
|
||||
|
@ -138,14 +158,21 @@ local def = {
|
|||
|
||||
get_staticdata = function(self)
|
||||
return {
|
||||
has_wool = self.has_wool
|
||||
has_wool = self.has_wool,
|
||||
wool_color = self.wool_color,
|
||||
}
|
||||
end,
|
||||
|
||||
on_activate = function(self, staticdata)
|
||||
if self.has_wool == false then
|
||||
self.object:set_properties({textures = {"creatures_sheep.png"}})
|
||||
if self.has_wool == nil then
|
||||
self.has_wool = true
|
||||
end
|
||||
|
||||
if not self.wool_color then
|
||||
self.wool_color = creatures.rnd(colors) or "white"
|
||||
end
|
||||
-- update fur
|
||||
setColor(self)
|
||||
end,
|
||||
|
||||
on_rightclick = function(self, clicker)
|
||||
|
@ -160,6 +187,7 @@ local def = {
|
|||
if not self.tamed then
|
||||
self.fed_cnt = (self.fed_cnt or 0) + 1
|
||||
end
|
||||
|
||||
-- play eat sound?
|
||||
item:take_item()
|
||||
elseif name == "creatures:shears" and self.has_wool then
|
||||
|
@ -170,21 +198,17 @@ local def = {
|
|||
clicker:set_wielded_item(item)
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
if self.has_wool == nil then
|
||||
self.has_wool = true
|
||||
end
|
||||
if self.mode == "eat" and self.eat_node then
|
||||
self.regrow_wool = true
|
||||
end
|
||||
if self.last_mode == "eat" and (self.modetimer and self.modetimer == 0) and self.regrow_wool then
|
||||
self.has_wool = true
|
||||
self.regrow_wool = nil
|
||||
self.object:set_properties({textures = {"creatures_sheep.png^creatures_sheep_white.png"}})
|
||||
setColor(self)
|
||||
end
|
||||
if self.fed_cnt and self.fed_cnt > 4 then
|
||||
self.tamed = true
|
||||
|
|
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 5.5 KiB |
|
@ -51,7 +51,7 @@ local def = {
|
|||
model = {
|
||||
mesh = "creatures_zombie.b3d",
|
||||
textures = {"creatures_zombie.png"},
|
||||
collisionbox = {-0.25, -0.01, -0.3, 0.25, 1.75, 0.3},
|
||||
collisionbox = {-0.25, -0.01, -0.25, 0.25, 1.65, 0.25},
|
||||
rotation = -90.0,
|
||||
animations = {
|
||||
idle = {start = 0, stop = 80, speed = 15},
|
||||
|
|