Compare commits

...

5 Commits

Author SHA1 Message Date
BlockMen 1694be3f32 Publish old stuff from disk
Just found these changes on my localspace. idk if all works, just thought it may be more useful here than on my disk.
2018-09-17 13:46:15 +02:00
BlockMen e3502a1c81 Push to Version 2.3.1 2016-02-16 23:24:03 +01:00
BlockMen 4096344c6f Add colored Sheep
Sheep spawn randomly with white, grey, brown or black wool
2016-02-16 23:21:35 +01:00
BlockMen ac569c49a9 Fix Oerrki spawn time 2016-02-15 14:37:26 +01:00
BlockMen a11ca58729 Push to Version 2.3 2016-02-11 17:55:41 +01:00
29 changed files with 342 additions and 204 deletions

View File

@ -4,6 +4,14 @@ Creatures MOB-Engine API
creatures.register_mob(#Creature definition) creatures.register_mob(#Creature definition)
-registers a mob at MOB-Engine; returns true when sucessfull -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) creatures.rnd(chance_table)
-returns a weighted random table element; chance_sum of table must be 1 -returns a weighted random table element; chance_sum of table must be 1
^ example: creatures.rnd({elem1 = {chance = 0.7}, {elem2 = {chance = 0.3}}) ^ example: creatures.rnd({elem1 = {chance = 0.7}, {elem2 = {chance = 0.3}})

View File

@ -1,22 +1,22 @@
Mod/Modpack Creatures 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. 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: License:
~~~~~~~~ ~~~~~~~~
Code(if not stated differently): 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. see "LICENSE.txt" for details.
Media(if not stated differently): 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. see each MOB-Module for detailed informations.

View File

@ -24,3 +24,17 @@ Version 2.2.2
- Chicken drop chicken meat and feather(s) on death - Chicken drop chicken meat and feather(s) on death
- Fixed spawn eggs being endless in singleplayer - Fixed spawn eggs being endless in singleplayer
- Fix searching for target if in panic mode - 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)

View File

@ -2,13 +2,14 @@ Chicken for Creatures MOB-Engine
================================ ================================
Copyright (c) 2015-2016 BlockMen <blockmen2015@gmail.com> Copyright (c) 2015-2016 BlockMen <blockmen2015@gmail.com>
Version: 2.2 Version: 2.3
Adds chicken to Minetest (requires Creatures MOB-Engine). 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 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 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: License:

View File

@ -55,6 +55,12 @@ core.register_craftitem(":creatures:feather", {
inventory_image = "creatures_feather.png", inventory_image = "creatures_feather.png",
}) })
local colors = {
white = {chance = 0.7},
brown = {chance = 0.3}
}
local def = { local def = {
-- general -- general
name = "creatures:chicken", name = "creatures:chicken",
@ -74,14 +80,14 @@ local def = {
idle2 = {chance = 0.69, duration = 0.8}, idle2 = {chance = 0.69, duration = 0.8},
pick = {chance = 0.2, duration = 2}, pick = {chance = 0.2, duration = 2},
walk = {chance = 0.2, duration = 5.5, moving_speed = 0.7, update_yaw = 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}, lay_egg = {chance = 0.01, duration = 1},
}, },
model = { model = {
mesh = "creatures_chicken.b3d", mesh = "creatures_chicken.b3d",
textures = {"creatures_chicken.png"}, textures = {"creatures_chicken_white.png"},
collisionbox = {-0.25, -0.01, -0.3, 0.25, 0.45, 0.3}, collisionbox = {-0.19, -0.01, -0.19, 0.19, 0.52, 0.19},
rotation = 90.0, rotation = 90.0,
collide_with_objects = false, collide_with_objects = false,
animations = { animations = {
@ -126,6 +132,20 @@ local def = {
{"creatures:feather", {min = 1, max = 2}, chance = 0.45}, {"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) on_step = function(self, dtime)
if self.mode == "lay_egg" then if self.mode == "lay_egg" then
dropEgg(self.object) dropEgg(self.object)

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 710 B

View File

@ -25,17 +25,25 @@ nullVec = {x = 0, y = 0, z = 0}
DEGTORAD = math.pi / 180.0 DEGTORAD = math.pi / 180.0
-- common functions -- 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 if not errval then
errval = false errval = false
end end
local res = 1000000000 local res = 1000000000
local rn = math.random(0, res - 1) local rn = math.random(0, res - 1)
local retval = nil local retval = nil
local psum = 0 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) psum = psum + ((tonumber(w) or w.chance or 0) * res)
if psum > rn then if psum > rn then
retval = s retval = s
@ -50,6 +58,10 @@ function throw_error(msg)
core.log("error", "#Creatures: ERROR: " .. msg) core.log("error", "#Creatures: ERROR: " .. msg)
end end
function throw_warning(msg)
core.log("warning", "#Creatures: WARNING: " .. msg)
end
function creatures.compare_pos(pos1, pos2) function creatures.compare_pos(pos1, pos2)
if not pos1 or not pos2 then if not pos1 or not pos2 then
return return
@ -64,8 +76,8 @@ function creatures.findTarget(search_obj, pos, radius, search_type, ignore_mob,
local player_near = false local player_near = false
local mobs = {} local mobs = {}
for _,obj in ipairs(core.get_objects_inside_radius(pos, radius)) do for _,obj in ipairs(core.get_objects_inside_radius(pos, radius)) do
if obj ~= search_obj then if obj ~= search_obj then
if xray or core.line_of_sight(pos, obj:getpos()) == true then if xray or core.line_of_sight(pos, obj:getpos()) == true then
local is_player = obj:is_player() local is_player = obj:is_player()
if is_player then if is_player then
player_near = true player_near = true
@ -73,33 +85,33 @@ function creatures.findTarget(search_obj, pos, radius, search_type, ignore_mob,
return {}, true return {}, true
end end
end end
local entity = obj:get_luaentity() local entity = obj:get_luaentity()
local isItem = (entity and entity.name == "__builtin:item") or false 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 ignore = (entity and entity.mob_name == ignore_mob and search_type ~= "mates") or false
if search_type == "all" then if search_type == "all" then
if not isItem and not ignore then if not isItem and not ignore then
table.insert(mobs, obj) table.insert(mobs, obj)
end end
elseif search_type == "hostile" then elseif search_type == "hostile" then
if not ignore and (entity and entity.hostile == true) or is_player then if not ignore and (entity and entity.hostile == true) or is_player then
table.insert(mobs, obj) table.insert(mobs, obj)
end end
elseif search_type == "nonhostile" then elseif search_type == "nonhostile" then
if entity and not entity.hostile and not isItem and not ignore then if entity and not entity.hostile and not isItem and not ignore then
table.insert(mobs, obj) table.insert(mobs, obj)
end end
elseif search_type == "player" then elseif search_type == "player" then
if is_player then if is_player then
table.insert(mobs, obj) table.insert(mobs, obj)
end end
elseif search_type == "mate" then elseif search_type == "mate" then
if not isItem and (entity and entity.mob_name == ignore_mob) then if not isItem and (entity and entity.mob_name == ignore_mob) then
table.insert(mobs, obj) table.insert(mobs, obj)
end end
end end
end end
end --for end --for
end end
return mobs,player_near return mobs,player_near

View File

@ -53,6 +53,18 @@ local function translate_def(def)
--if name == "attack" then new_def.modes[name].chance = 0 end --if name == "attack" then new_def.modes[name].chance = 0 end
end 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 -- insert special mode "_run" which is used when in panic
if def.stats.can_panic then if def.stats.can_panic then
if def.modes.walk then if def.modes.walk then
@ -578,3 +590,46 @@ function creatures.register_spawner(spawner_def)
return true return true
end 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

View File

@ -45,7 +45,7 @@ local def = {
model = { model = {
mesh = "creatures_ghost.b3d", mesh = "creatures_ghost.b3d",
textures = {"creatures_ghost.png"}, 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, rotation = -90.0,
animations = { animations = {
idle = {start = 0, stop = 80, speed = 15}, idle = {start = 0, stop = 80, speed = 15},

View File

@ -1,12 +1,12 @@
Oerrki for Creatures MOB-Engine Oerkki for Creatures MOB-Engine
=============================== ===============================
Copyright (c) 2016 BlockMen <blockmen2015@gmail.com> Copyright (c) 2016 BlockMen <blockmen2015@gmail.com>
Version: 1.0 Beta Version: 1.0 Beta
Adds classic Minetest Ghost called "Oerrki". (requires Creatures MOB-Engine). Adds classic Minetest Ghost called "Oerkki". (requires Creatures MOB-Engine).
Oerrki spawn only at night or in dark places and remain around 5 minutes in the world. 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. Other than Ghosts or Zombies they don't die by sunlight.

View File

@ -1,3 +1,3 @@
default default
creatures creatures
oerrki?

View File

@ -1,4 +1,4 @@
--= Oerrki for Creatures MOB-Engine (cme) =-- --= Oerkki for Creatures MOB-Engine (cme) =--
-- Copyright (c) 2016 BlockMen <blockmen2015@gmail.com> -- Copyright (c) 2016 BlockMen <blockmen2015@gmail.com>
-- --
-- init.lua -- init.lua
@ -21,7 +21,7 @@
local def = { local def = {
name = "creatures:oerrki", name = "creatures:oerkki",
stats = { stats = {
hp = 13, hp = 13,
lifetime = 540, -- 9 Minutes lifetime = 540, -- 9 Minutes
@ -36,9 +36,9 @@ local def = {
}, },
model = { model = {
mesh = "creatures_oerrki.b3d", mesh = "creatures_oerkki.b3d",
textures = {"creatures_oerrki.png"}, textures = {"creatures_oerkki.png"},
collisionbox = {-0.25, -0.01, -0.3, 0.25, 1.75, 0.3}, collisionbox = {-0.22, -0.01, -0.22, 0.22, 1.65, 0.22},
rotation = -90.0, rotation = -90.0,
animations = { animations = {
idle = {start = 1, stop = 23, speed = 15}, idle = {start = 1, stop = 23, speed = 15},
@ -50,12 +50,12 @@ local def = {
}, },
sounds = { sounds = {
on_damage = {name = "creatures_oerrki_hit", gain = 1.0, distance = 10}, on_damage = {name = "creatures_oerkki_hit", gain = 1.0, distance = 10},
on_death = {name = "creatures_oerrki_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}, swim = {name = "creatures_splash", gain = 1.0, distance = 10},
random = { random = {
idle = {name = "creatures_oerrki_idle", gain = 1.0, distance = 25}, idle = {name = "creatures_oerkki_idle", gain = 1.0, distance = 25},
attack = {name = "creatures_oerrki_attack", gain = 1.0, distance = 20}, attack = {name = "creatures_oerkki_attack", gain = 1.0, distance = 20},
}, },
}, },
@ -88,17 +88,17 @@ local def = {
abm_chance = 7800, abm_chance = 7800,
max_number = 1, max_number = 1,
number = {min = 1, max = 3}, number = {min = 1, max = 3},
time_range = {min = 5100, max = 18300}, time_range = {min = 18500, max = 5100},
light = {min = 0, max = 8}, light = {min = 0, max = 8},
height_limit = {min = -200, max = 50}, height_limit = {min = -200, max = 50},
spawn_egg = { spawn_egg = {
description = "Oerrki Spawn-Egg", description = "Oerkki Spawn-Egg",
texture = "creatures_egg_oerrki.png", texture = "creatures_egg_oerkki.png",
}, },
spawner = { spawner = {
description = "Oerrki Spawner", description = "Oerkki Spawner",
range = 8, range = 8,
player_range = 20, player_range = 20,
number = 6, number = 6,
@ -108,3 +108,6 @@ local def = {
} }
creatures.register_mob(def) creatures.register_mob(def)
-- Convert "Oerrki's" (caused by typo)
creatures.register_alias("creatures:oerrki", "creatures:oerkki")

View File

Before

Width:  |  Height:  |  Size: 695 B

After

Width:  |  Height:  |  Size: 695 B

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -1,12 +1,13 @@
Sheep for Creatures MOB-Engine 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). 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. 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 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. 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. 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: License:
~~~~~~~~ ~~~~~~~~
Code: Code:
(c) Copyright 2015 BlockMen; modified zlib-License (c) Copyright 2015-2016 BlockMen; modified zlib-License
see "LICENSE.txt" for details. see "LICENSE.txt" for details.
Media(textures and meshes/models): 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: Sounds:
- creatures_sheep.1.ogg, confusion_music(https://freesound.org/people/confusion_music) CC-BY 3.0 - creatures_sheep.1.ogg, confusion_music(https://freesound.org/people/confusion_music) CC-BY 3.0

View File

@ -1,5 +1,5 @@
--= Sheep for Creatures MOB-Engine (cme) =-- --= Sheep for Creatures MOB-Engine (cme) =--
-- Copyright (c) 2015 BlockMen <blockmen2015@gmail.com> -- Copyright (c) 2015-2016 BlockMen <blockmen2015@gmail.com>
-- --
-- init.lua -- 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 local function setColor(self)
core.sound_play("creatures_shears", {pos = pos, gain = 1, max_hear_distance = 10}) if self and self.object then
end local ext = ".png"
self.object:set_properties({textures = {"creatures_sheep.png"}}) if self.has_wool ~= true then
creatures.dropItems(pos, {{"wool:white", drop_count}}) ext = ".png^(creatures_sheep_shaved.png^[colorize:" .. self.wool_color:gsub("grey", "gray") .. ":50)"
end end
self.object:set_properties({textures = {"creatures_sheep.png^creatures_sheep_" .. self.wool_color .. ext}})
end
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 = { local def = {
name = "creatures:sheep", name = "creatures:sheep",
stats = { stats = {
hp = 8, hp = 8,
lifetime = 450, -- 7,5 Minutes lifetime = 450, -- 7,5 Minutes
can_jump = 1, can_jump = 1,
can_swim = true, can_swim = true,
can_burn = true, can_burn = true,
can_panic = true, can_panic = true,
has_falldamage = true, has_falldamage = true,
has_kockback = true, has_kockback = true,
}, },
model = { model = {
mesh = "creatures_sheep.b3d", mesh = "creatures_sheep.b3d",
textures = {"creatures_sheep.png^creatures_sheep_white.png"}, 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, rotation = -90.0,
animations = { animations = {
idle = {start = 1, stop = 60, speed = 15}, idle = {start = 1, stop = 60, speed = 15},
walk = {start = 81, stop = 101, speed = 18}, walk = {start = 81, stop = 101, speed = 18},
walk_long = {start = 81, stop = 101, speed = 18}, walk_long = {start = 81, stop = 101, speed = 18},
eat = {start = 107, stop = 170, speed = 12, loop = false}, eat = {start = 107, stop = 170, speed = 12, loop = false},
follow = {start = 81, stop = 101, speed = 15}, follow = {start = 81, stop = 101, speed = 15},
death = {start = 171, stop = 191, speed = 32, loop = false, duration = 2.52}, death = {start = 171, stop = 191, speed = 32, loop = false, duration = 2.52},
}, },
}, },
sounds = { sounds = {
on_damage = {name = "creatures_sheep", gain = 1.0, distance = 10}, on_damage = {name = "creatures_sheep", gain = 1.0, distance = 10},
on_death = {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,}, swim = {name = "creatures_splash", gain = 1.0, distance = 10,},
random = { random = {
idle = {name = "creatures_sheep", gain = 0.6, distance = 10, time_min = 23}, idle = {name = "creatures_sheep", gain = 0.6, distance = 10, time_min = 23},
}, },
}, },
modes = { modes = {
idle = {chance = 0.5, duration = 10, update_yaw = 8}, idle = {chance = 0.5, duration = 10, update_yaw = 8},
walk = {chance = 0.14, duration = 4.5, moving_speed = 1.3}, 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}, walk_long = {chance = 0.11, duration = 8, moving_speed = 1.3, update_yaw = 5},
-- special modes -- special modes
follow = {chance = 0, duration = 20, radius = 4, timer = 5, moving_speed = 1, items = {"farming:wheat"}}, 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, duration = 4,
nodes = { nodes = {
"default:grass_1", "default:grass_2", "default:grass_3", "default:grass_1", "default:grass_2", "default:grass_3",
"default:grass_4", "default:grass_5", "default:dirt_with_grass" "default:grass_4", "default:grass_5", "default:dirt_with_grass"
} }
}, },
}, },
drops = function(self) drops = function(self)
local items = {{"creatures:flesh"}} local items = {{"creatures:flesh"}}
if self.has_wool then 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 end
creatures.dropItems(self.object:getpos(), items) creatures.dropItems(self.object:getpos(), items)
end, end,
spawning = { spawning = {
abm_nodes = { abm_nodes = {
spawn_on = {"default:dirt_with_grass"}, spawn_on = {"default:dirt_with_grass"},
}, },
abm_interval = 55, abm_interval = 55,
abm_chance = 7800, abm_chance = 7800,
max_number = 1, max_number = 1,
number = {min = 1, max = 3}, number = {min = 1, max = 3},
time_range = {min = 5100, max = 18300}, time_range = {min = 5100, max = 18300},
light = {min = 10, max = 15}, light = {min = 10, max = 15},
height_limit = {min = 0, max = 25}, height_limit = {min = 0, max = 25},
spawn_egg = { spawn_egg = {
description = "Sheep Spawn-Egg", description = "Sheep Spawn-Egg",
texture = "creatures_egg_sheep.png", texture = "creatures_egg_sheep.png",
}, },
spawner = { spawner = {
description = "Sheep Spawner", description = "Sheep Spawner",
range = 8, range = 8,
player_range = 20, player_range = 20,
number = 6, number = 6,
} }
}, },
on_punch = function(self, puncher) on_punch = function(self, puncher)
shear(self) shear(self)
end, end,
get_staticdata = function(self) get_staticdata = function(self)
return { return {
has_wool = self.has_wool has_wool = self.has_wool,
} wool_color = self.wool_color,
end, }
end,
on_activate = function(self, staticdata) on_activate = function(self, staticdata)
if self.has_wool == false then if self.has_wool == nil then
self.object:set_properties({textures = {"creatures_sheep.png"}}) self.has_wool = true
end end
end,
on_rightclick = function(self, clicker) if not self.wool_color then
local item = clicker:get_wielded_item() self.wool_color = creatures.rnd(colors) or "white"
if item then end
local name = item:get_name() -- update fur
if name == "farming:wheat" then setColor(self)
self.target = clicker end,
self.mode = "follow"
self.modetimer = 0
if not self.tamed then on_rightclick = function(self, clicker)
self.fed_cnt = (self.fed_cnt or 0) + 1 local item = clicker:get_wielded_item()
end if item then
-- play eat sound? local name = item:get_name()
item:take_item() if name == "farming:wheat" then
elseif name == "creatures:shears" and self.has_wool then self.target = clicker
shear(self, math.random(2, 3), true) self.mode = "follow"
item:add_wear(65535/100) self.modetimer = 0
end
if not core.setting_getbool("creative_mode") then
clicker:set_wielded_item(item)
end
end
return true if not self.tamed then
end, self.fed_cnt = (self.fed_cnt or 0) + 1
end
on_step = function(self, dtime) -- play eat sound?
if self.has_wool == nil then item:take_item()
self.has_wool = true elseif name == "creatures:shears" and self.has_wool then
end shear(self, math.random(2, 3), true)
if self.mode == "eat" and self.eat_node then item:add_wear(65535/100)
self.regrow_wool = true end
end if not core.setting_getbool("creative_mode") then
if self.last_mode == "eat" and (self.modetimer and self.modetimer == 0) and self.regrow_wool then clicker:set_wielded_item(item)
self.has_wool = true end
self.regrow_wool = nil end
self.object:set_properties({textures = {"creatures_sheep.png^creatures_sheep_white.png"}}) return true
end end,
if self.fed_cnt and self.fed_cnt > 4 then
self.tamed = true on_step = function(self, dtime)
self.fed_cnt = nil if self.mode == "eat" and self.eat_node then
end self.regrow_wool = true
end 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) creatures.register_mob(def)

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -51,7 +51,7 @@ local def = {
model = { model = {
mesh = "creatures_zombie.b3d", mesh = "creatures_zombie.b3d",
textures = {"creatures_zombie.png"}, 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, rotation = -90.0,
animations = { animations = {
idle = {start = 0, stop = 80, speed = 15}, idle = {start = 0, stop = 80, speed = 15},