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,17 +25,25 @@ 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
|
||||
|
||||
local res = 1000000000
|
||||
local rn = math.random(0, res - 1)
|
||||
local retval = nil
|
||||
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
|
||||
|
@ -64,8 +76,8 @@ function creatures.findTarget(search_obj, pos, radius, search_type, ignore_mob,
|
|||
local player_near = false
|
||||
local mobs = {}
|
||||
for _,obj in ipairs(core.get_objects_inside_radius(pos, radius)) do
|
||||
if obj ~= search_obj then
|
||||
if xray or core.line_of_sight(pos, obj:getpos()) == true then
|
||||
if obj ~= search_obj then
|
||||
if xray or core.line_of_sight(pos, obj:getpos()) == true then
|
||||
local is_player = obj:is_player()
|
||||
if is_player then
|
||||
player_near = true
|
||||
|
@ -73,33 +85,33 @@ function creatures.findTarget(search_obj, pos, radius, search_type, ignore_mob,
|
|||
return {}, true
|
||||
end
|
||||
end
|
||||
local entity = obj:get_luaentity()
|
||||
local isItem = (entity and entity.name == "__builtin:item") or false
|
||||
local ignore = (entity and entity.mob_name == ignore_mob and search_type ~= "mates") or false
|
||||
local entity = obj:get_luaentity()
|
||||
local isItem = (entity and entity.name == "__builtin:item") or false
|
||||
local ignore = (entity and entity.mob_name == ignore_mob and search_type ~= "mates") or false
|
||||
|
||||
if search_type == "all" then
|
||||
if not isItem and not ignore then
|
||||
table.insert(mobs, obj)
|
||||
end
|
||||
elseif search_type == "hostile" then
|
||||
if not ignore and (entity and entity.hostile == true) or is_player then
|
||||
table.insert(mobs, obj)
|
||||
end
|
||||
elseif search_type == "nonhostile" then
|
||||
if entity and not entity.hostile and not isItem and not ignore then
|
||||
table.insert(mobs, obj)
|
||||
end
|
||||
elseif search_type == "player" then
|
||||
if is_player then
|
||||
table.insert(mobs, obj)
|
||||
end
|
||||
elseif search_type == "mate" then
|
||||
if not isItem and (entity and entity.mob_name == ignore_mob) then
|
||||
table.insert(mobs, obj)
|
||||
end
|
||||
end
|
||||
end
|
||||
end --for
|
||||
if search_type == "all" then
|
||||
if not isItem and not ignore then
|
||||
table.insert(mobs, obj)
|
||||
end
|
||||
elseif search_type == "hostile" then
|
||||
if not ignore and (entity and entity.hostile == true) or is_player then
|
||||
table.insert(mobs, obj)
|
||||
end
|
||||
elseif search_type == "nonhostile" then
|
||||
if entity and not entity.hostile and not isItem and not ignore then
|
||||
table.insert(mobs, obj)
|
||||
end
|
||||
elseif search_type == "player" then
|
||||
if is_player then
|
||||
table.insert(mobs, obj)
|
||||
end
|
||||
elseif search_type == "mate" then
|
||||
if not isItem and (entity and entity.mob_name == ignore_mob) then
|
||||
table.insert(mobs, obj)
|
||||
end
|
||||
end
|
||||
end
|
||||
end --for
|
||||
end
|
||||
|
||||
return mobs,player_near
|
||||
|
|
|
@ -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
|
||||
|
|
304
sheep/init.lua
|
@ -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,163 +34,187 @@ core.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
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}})
|
||||
end
|
||||
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
|
||||
|
||||
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 = {
|
||||
hp = 8,
|
||||
lifetime = 450, -- 7,5 Minutes
|
||||
can_jump = 1,
|
||||
can_swim = true,
|
||||
can_burn = true,
|
||||
can_panic = true,
|
||||
has_falldamage = true,
|
||||
has_kockback = true,
|
||||
},
|
||||
name = "creatures:sheep",
|
||||
stats = {
|
||||
hp = 8,
|
||||
lifetime = 450, -- 7,5 Minutes
|
||||
can_jump = 1,
|
||||
can_swim = true,
|
||||
can_burn = true,
|
||||
can_panic = true,
|
||||
has_falldamage = true,
|
||||
has_kockback = true,
|
||||
},
|
||||
|
||||
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},
|
||||
rotation = -90.0,
|
||||
animations = {
|
||||
idle = {start = 1, stop = 60, speed = 15},
|
||||
walk = {start = 81, stop = 101, speed = 18},
|
||||
walk_long = {start = 81, stop = 101, speed = 18},
|
||||
eat = {start = 107, stop = 170, speed = 12, loop = false},
|
||||
follow = {start = 81, stop = 101, speed = 15},
|
||||
death = {start = 171, stop = 191, speed = 32, loop = false, duration = 2.52},
|
||||
},
|
||||
},
|
||||
model = {
|
||||
mesh = "creatures_sheep.b3d",
|
||||
textures = {"creatures_sheep.png^creatures_sheep_white.png"},
|
||||
collisionbox = {-0.45, -0.01, -0.45, 0.45, 1.06, 0.45},
|
||||
rotation = -90.0,
|
||||
animations = {
|
||||
idle = {start = 1, stop = 60, speed = 15},
|
||||
walk = {start = 81, stop = 101, speed = 18},
|
||||
walk_long = {start = 81, stop = 101, speed = 18},
|
||||
eat = {start = 107, stop = 170, speed = 12, loop = false},
|
||||
follow = {start = 81, stop = 101, speed = 15},
|
||||
death = {start = 171, stop = 191, speed = 32, loop = false, duration = 2.52},
|
||||
},
|
||||
},
|
||||
|
||||
sounds = {
|
||||
on_damage = {name = "creatures_sheep", gain = 1.0, distance = 10},
|
||||
on_death = {name = "creatures_sheep", gain = 1.0, distance = 10},
|
||||
swim = {name = "creatures_splash", gain = 1.0, distance = 10,},
|
||||
random = {
|
||||
idle = {name = "creatures_sheep", gain = 0.6, distance = 10, time_min = 23},
|
||||
},
|
||||
},
|
||||
sounds = {
|
||||
on_damage = {name = "creatures_sheep", gain = 1.0, distance = 10},
|
||||
on_death = {name = "creatures_sheep", gain = 1.0, distance = 10},
|
||||
swim = {name = "creatures_splash", gain = 1.0, distance = 10,},
|
||||
random = {
|
||||
idle = {name = "creatures_sheep", gain = 0.6, distance = 10, time_min = 23},
|
||||
},
|
||||
},
|
||||
|
||||
modes = {
|
||||
idle = {chance = 0.5, duration = 10, update_yaw = 8},
|
||||
walk = {chance = 0.14, duration = 4.5, moving_speed = 1.3},
|
||||
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,
|
||||
duration = 4,
|
||||
nodes = {
|
||||
"default:grass_1", "default:grass_2", "default:grass_3",
|
||||
"default:grass_4", "default:grass_5", "default:dirt_with_grass"
|
||||
}
|
||||
},
|
||||
},
|
||||
modes = {
|
||||
idle = {chance = 0.5, duration = 10, update_yaw = 8},
|
||||
walk = {chance = 0.14, duration = 4.5, moving_speed = 1.3},
|
||||
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,
|
||||
duration = 4,
|
||||
nodes = {
|
||||
"default:grass_1", "default:grass_2", "default:grass_3",
|
||||
"default:grass_4", "default:grass_5", "default:dirt_with_grass"
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
drops = function(self)
|
||||
local items = {{"creatures:flesh"}}
|
||||
if self.has_wool then
|
||||
table.insert(items, {"wool:white", {min = 1, max = 2}})
|
||||
end
|
||||
creatures.dropItems(self.object:getpos(), items)
|
||||
end,
|
||||
drops = function(self)
|
||||
local items = {{"creatures:flesh"}}
|
||||
if self.has_wool then
|
||||
table.insert(items, {"wool:" .. self.wool_color, {min = 1, max = 2}})
|
||||
end
|
||||
creatures.dropItems(self.object:getpos(), items)
|
||||
end,
|
||||
|
||||
spawning = {
|
||||
abm_nodes = {
|
||||
spawn_on = {"default:dirt_with_grass"},
|
||||
},
|
||||
abm_interval = 55,
|
||||
abm_chance = 7800,
|
||||
max_number = 1,
|
||||
number = {min = 1, max = 3},
|
||||
time_range = {min = 5100, max = 18300},
|
||||
light = {min = 10, max = 15},
|
||||
height_limit = {min = 0, max = 25},
|
||||
spawning = {
|
||||
abm_nodes = {
|
||||
spawn_on = {"default:dirt_with_grass"},
|
||||
},
|
||||
abm_interval = 55,
|
||||
abm_chance = 7800,
|
||||
max_number = 1,
|
||||
number = {min = 1, max = 3},
|
||||
time_range = {min = 5100, max = 18300},
|
||||
light = {min = 10, max = 15},
|
||||
height_limit = {min = 0, max = 25},
|
||||
|
||||
spawn_egg = {
|
||||
description = "Sheep Spawn-Egg",
|
||||
texture = "creatures_egg_sheep.png",
|
||||
},
|
||||
spawn_egg = {
|
||||
description = "Sheep Spawn-Egg",
|
||||
texture = "creatures_egg_sheep.png",
|
||||
},
|
||||
|
||||
spawner = {
|
||||
description = "Sheep Spawner",
|
||||
range = 8,
|
||||
player_range = 20,
|
||||
number = 6,
|
||||
}
|
||||
},
|
||||
spawner = {
|
||||
description = "Sheep Spawner",
|
||||
range = 8,
|
||||
player_range = 20,
|
||||
number = 6,
|
||||
}
|
||||
},
|
||||
|
||||
on_punch = function(self, puncher)
|
||||
shear(self)
|
||||
end,
|
||||
on_punch = function(self, puncher)
|
||||
shear(self)
|
||||
end,
|
||||
|
||||
get_staticdata = function(self)
|
||||
return {
|
||||
has_wool = self.has_wool
|
||||
}
|
||||
end,
|
||||
get_staticdata = function(self)
|
||||
return {
|
||||
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"}})
|
||||
end
|
||||
end,
|
||||
on_activate = function(self, staticdata)
|
||||
if self.has_wool == nil then
|
||||
self.has_wool = true
|
||||
end
|
||||
|
||||
on_rightclick = function(self, clicker)
|
||||
local item = clicker:get_wielded_item()
|
||||
if item then
|
||||
local name = item:get_name()
|
||||
if name == "farming:wheat" then
|
||||
self.target = clicker
|
||||
self.mode = "follow"
|
||||
self.modetimer = 0
|
||||
if not self.wool_color then
|
||||
self.wool_color = creatures.rnd(colors) or "white"
|
||||
end
|
||||
-- update fur
|
||||
setColor(self)
|
||||
end,
|
||||
|
||||
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
|
||||
shear(self, math.random(2, 3), true)
|
||||
item:add_wear(65535/100)
|
||||
end
|
||||
if not core.setting_getbool("creative_mode") then
|
||||
clicker:set_wielded_item(item)
|
||||
end
|
||||
end
|
||||
on_rightclick = function(self, clicker)
|
||||
local item = clicker:get_wielded_item()
|
||||
if item then
|
||||
local name = item:get_name()
|
||||
if name == "farming:wheat" then
|
||||
self.target = clicker
|
||||
self.mode = "follow"
|
||||
self.modetimer = 0
|
||||
|
||||
return true
|
||||
end,
|
||||
if not self.tamed then
|
||||
self.fed_cnt = (self.fed_cnt or 0) + 1
|
||||
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"}})
|
||||
end
|
||||
if self.fed_cnt and self.fed_cnt > 4 then
|
||||
self.tamed = true
|
||||
self.fed_cnt = nil
|
||||
end
|
||||
end
|
||||
-- play eat sound?
|
||||
item:take_item()
|
||||
elseif name == "creatures:shears" and self.has_wool then
|
||||
shear(self, math.random(2, 3), true)
|
||||
item:add_wear(65535/100)
|
||||
end
|
||||
if not core.setting_getbool("creative_mode") then
|
||||
clicker:set_wielded_item(item)
|
||||
end
|
||||
end
|
||||
return true
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
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
|
||||
setColor(self)
|
||||
end
|
||||
if self.fed_cnt and self.fed_cnt > 4 then
|
||||
self.tamed = true
|
||||
self.fed_cnt = nil
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
creatures.register_mob(def)
|
||||
|
|
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},
|
||||
|
|