Compare commits
5 Commits
5a1bcc0bab
...
4183c142aa
Author | SHA1 | Date |
---|---|---|
BlockMen | 4183c142aa | |
BlockMen | 79a54e7907 | |
BlockMen | 3a2e312f01 | |
ExcaliburZero | 0b7184426a | |
vitaminx | 9a4141536b |
12
README.txt
12
README.txt
|
@ -1,8 +1,8 @@
|
|||
Minetest mod "Creatures"
|
||||
=======================
|
||||
by BlockMen (c) 2014
|
||||
by BlockMen (c) 2014 - 2015
|
||||
|
||||
Version: 1.1.4 Beta
|
||||
Version: 1.1.5 Beta
|
||||
|
||||
About
|
||||
~~~~~
|
||||
|
@ -40,7 +40,7 @@ steel ingot stick
|
|||
|
||||
License of source code, textures and mesh model: WTFPL
|
||||
------------------------------------------------------
|
||||
(c) Copyright BlockMen (2014)
|
||||
(c) Copyright BlockMen 2014 - 2015
|
||||
|
||||
|
||||
Licenses of sounds
|
||||
|
@ -100,6 +100,12 @@ Changelog:
|
|||
- Sheep are not stuck that often in valleys; spawning less
|
||||
- Improved jumping of zombies and sheep
|
||||
|
||||
# 1.1.5
|
||||
- Fixed global variable (by vitaminx)
|
||||
- Added description.txt and screenshot (by ExcaliburZero)
|
||||
- Fixed sounds (zombie and sheep)
|
||||
- Using [colorize modifier instead of texture overlays
|
||||
|
||||
This program is free software. It comes without any warranty, to
|
||||
the extent permitted by applicable law. You can redistribute it
|
||||
and/or modify it under the terms of the Do What The Fuck You Want
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "creatures",
|
||||
"description": "This mod adds several creatures to Minetest, including zombies, ghosts, and sheep.\n",
|
||||
"keywords": [
|
||||
"creatures",
|
||||
"mobs",
|
||||
"zombies",
|
||||
"sheep",
|
||||
"ghost",
|
||||
"monsters",
|
||||
"hostile"
|
||||
],
|
||||
"homepage": "https://github.com/BlockMen/creatures",
|
||||
"forum": "http://forum.minetest.net/viewtopic.php?f=11&t=8638",
|
||||
"screenshots": [
|
||||
"https://raw.githubusercontent.com/BlockMen/creatures/master/screenshot.png"
|
||||
],
|
||||
"authors": [
|
||||
"BlockMen"
|
||||
]
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
This mod adds several creatures to Minetest, including zombies, ghosts, and sheep.
|
14
ghost.lua
14
ghost.lua
|
@ -25,19 +25,15 @@ function g_hit(self)
|
|||
local sound = g_sound_hit
|
||||
if self.object:get_hp() < 1 then sound = g_sound_dead end
|
||||
minetest.sound_play(sound, {pos = self.object:getpos(), max_hear_distance = 10, loop = false, gain = 0.4})
|
||||
prop = {
|
||||
mesh = g_mesh,
|
||||
textures = {"creatures_ghost.png^creatures_ghost_hit.png"},
|
||||
}
|
||||
self.object:set_properties(prop)
|
||||
self.object:settexturemod("^[colorize:#c4000099")
|
||||
self.can_punch = false
|
||||
minetest.after(0.4, function()
|
||||
g_update_visuals_def(self)
|
||||
self.can_punch = true
|
||||
self.object:settexturemod("")
|
||||
end)
|
||||
end
|
||||
|
||||
function g_update_visuals_def(self)
|
||||
self.can_punch = true
|
||||
function g_init_visuals(self)
|
||||
prop = {
|
||||
mesh = g_mesh,
|
||||
textures = g_texture,
|
||||
|
@ -74,7 +70,7 @@ GHOST_DEF = {
|
|||
|
||||
|
||||
GHOST_DEF.on_activate = function(self)
|
||||
g_update_visuals_def(self)
|
||||
g_init_visuals(self)
|
||||
self.anim = g_get_animations()
|
||||
self.object:set_animation({x=self.anim.stand_START,y=self.anim.stand_END}, g_animation_speed, 0)
|
||||
self.npc_anim = ANIM_STAND
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 511 B |
Binary file not shown.
Before Width: | Height: | Size: 186 B |
Binary file not shown.
Before Width: | Height: | Size: 264 B |
Binary file not shown.
After Width: | Height: | Size: 246 KiB |
70
sheep.lua
70
sheep.lua
|
@ -27,32 +27,42 @@ local function s_get_animations()
|
|||
}
|
||||
end
|
||||
|
||||
local function s_eat_anim(self)
|
||||
self.object:set_animation({x=self.anim.eat_START,y=self.anim.eat_END}, s_animation_speed, 0)
|
||||
self.npc_anim = creatures.ANIM_EAT
|
||||
local function eat_cn(self, pos)
|
||||
self.object:setvelocity({x=0,y=-20,z=0})
|
||||
local p = {x=pos.x,y=pos.y-1,z=pos.z}
|
||||
local n = minetest.get_node(p) or nil
|
||||
if n and n.name and n.name == "default:dirt_with_grass" then
|
||||
self.object:set_animation({x=self.anim.eat_START,y=self.anim.eat_END}, s_animation_speed, 0)
|
||||
self.npc_anim = creatures.ANIM_EAT
|
||||
self.timer = 0
|
||||
minetest.after(3.5, function()
|
||||
self.has_wool = true
|
||||
self.state = 1
|
||||
s_update_visuals(self)
|
||||
minetest.set_node(p,{name="default:dirt"})
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function s_hit(self)
|
||||
local sound = s_sound_hit
|
||||
if self.object:get_hp() < 1 then sound = s_sound_dead end
|
||||
if self.object:get_hp() < 1 then
|
||||
sound = s_sound_dead
|
||||
end
|
||||
minetest.sound_play(sound, {pos = self.object:getpos(), max_hear_distance = 10, loop = false, gain = 0.4})
|
||||
prop = {
|
||||
mesh = s_mesh,
|
||||
textures = {self.txture[1].."^creatures_sheep_hit.png"},
|
||||
}
|
||||
self.object:set_properties(prop)
|
||||
s_update_visuals(self, "^[colorize:#c4000099")
|
||||
self.can_punch = false
|
||||
minetest.after(0.4, function()
|
||||
s_update_visuals_def(self)
|
||||
s_update_visuals(self)
|
||||
end)
|
||||
end
|
||||
|
||||
function s_update_visuals_def(self)
|
||||
self.txture = {"creatures_sheep.png"}
|
||||
function s_update_visuals(self, hit)
|
||||
self.txture = {"creatures_sheep.png" .. (hit or "")}
|
||||
if not self.has_wool then
|
||||
self.txture = {"creatures_sheep_shaved.png"}
|
||||
self.txture = {"creatures_sheep_shaved.png" .. (hit or "")}
|
||||
end
|
||||
prop = {
|
||||
local prop = {
|
||||
mesh = s_mesh,
|
||||
textures = self.txture,
|
||||
}
|
||||
|
@ -99,7 +109,7 @@ end
|
|||
|
||||
SHEEP_DEF.on_activate = function(self, staticdata, dtime_s)
|
||||
self.txture = s_texture
|
||||
s_update_visuals_def(self)
|
||||
s_update_visuals(self)
|
||||
self.anim = s_get_animations()
|
||||
self.object:set_animation({x=self.anim.stand_START,y=self.anim.stand_END}, s_animation_speed, 0)
|
||||
self.npc_anim = ANIM_STAND
|
||||
|
@ -126,7 +136,7 @@ SHEEP_DEF.on_activate = function(self, staticdata, dtime_s)
|
|||
self.lifetime = tmp.lifetime
|
||||
end
|
||||
if not self.has_wool then
|
||||
s_update_visuals_def(self)
|
||||
s_update_visuals(self)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -135,8 +145,6 @@ SHEEP_DEF.on_punch = function(self, puncher, time_from_last_punch, tool_capabili
|
|||
if not self.can_punch then return end
|
||||
|
||||
self.feeder = ""
|
||||
--SET RUN state (panic)
|
||||
self.state = 4
|
||||
self.timer = 0
|
||||
|
||||
if puncher ~= nil then
|
||||
|
@ -178,7 +186,7 @@ SHEEP_DEF.on_rightclick = function(self, clicker)
|
|||
minetest.sound_play(s_sound_shears, {pos = my_pos, max_hear_distance = 10, gain = 1})
|
||||
my_pos.y = my_pos.y + 0.4
|
||||
self.has_wool = false
|
||||
s_update_visuals_def(self)
|
||||
s_update_visuals(self)
|
||||
creatures.drop(my_pos, {{name=s_drop, count=2}})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
item:add_wear(65535/100)
|
||||
|
@ -251,6 +259,10 @@ SHEEP_DEF.on_step = function(self, dtime)
|
|||
end
|
||||
end
|
||||
|
||||
if self.state < 0 then
|
||||
return
|
||||
end
|
||||
|
||||
-- update moving state depending on current state
|
||||
if self.state < 4 then
|
||||
if self.timer > 4/self.state then
|
||||
|
@ -259,7 +271,7 @@ SHEEP_DEF.on_step = function(self, dtime)
|
|||
--if self.state == 3 then new = 1 end
|
||||
--if self.feeder == "" then new = 5 end
|
||||
self.state = 5--new
|
||||
s_update_visuals_def(self)
|
||||
--s_update_visuals(self)
|
||||
end
|
||||
elseif self.state == 4 and self.timer > 1.5 then
|
||||
self.state = 2
|
||||
|
@ -270,7 +282,6 @@ SHEEP_DEF.on_step = function(self, dtime)
|
|||
if self.feeder ~= "" then new = 5 end
|
||||
self.state = new
|
||||
self.timer = 0
|
||||
--s_update_visuals_def(self)
|
||||
end
|
||||
|
||||
-- play random sound
|
||||
|
@ -374,20 +385,9 @@ SHEEP_DEF.on_step = function(self, dtime)
|
|||
end
|
||||
|
||||
-- EATING
|
||||
if self.state == 3 then--and not self.has_wool then
|
||||
self.object:setvelocity({x=0,y=-20,z=0})
|
||||
local p = {x=current_pos.x,y=current_pos.y-1,z=current_pos.z}
|
||||
local n = minetest.get_node(p) or nil
|
||||
if n and n.name and n.name == "default:dirt_with_grass" then
|
||||
if self.timer == 0 then
|
||||
s_eat_anim(self)
|
||||
self.timer = 0.45
|
||||
end
|
||||
minetest.after(1.8,function()
|
||||
self.has_wool = true
|
||||
minetest.set_node(p,{name="default:dirt"})
|
||||
end)
|
||||
end
|
||||
if self.state == 3 then
|
||||
self.state = -1 -- deactivate most while eating
|
||||
eat_cn(self, current_pos)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
15
zombie.lua
15
zombie.lua
|
@ -36,19 +36,15 @@ function z_hit(self)
|
|||
local sound = z_sound_hit
|
||||
if self.object:get_hp() < 1 then sound = z_sound_dead end
|
||||
minetest.sound_play(sound, {pos = self.object:getpos(), max_hear_distance = 10, loop = false, gain = 0.4})
|
||||
prop = {
|
||||
mesh = z_mesh,
|
||||
textures = {"creatures_zombie.png^creatures_zombie_hit.png"},
|
||||
}
|
||||
self.object:set_properties(prop)
|
||||
self.object:settexturemod("^[colorize:#c4000099")
|
||||
self.can_punch = false
|
||||
minetest.after(0.4, function()
|
||||
z_update_visuals_def(self)
|
||||
self.can_punch = true
|
||||
self.object:settexturemod("")
|
||||
end)
|
||||
end
|
||||
|
||||
function z_update_visuals_def(self)
|
||||
self.can_punch = true
|
||||
function z_init_visuals(self)
|
||||
prop = {
|
||||
mesh = z_mesh,
|
||||
textures = z_texture,
|
||||
|
@ -92,7 +88,7 @@ ZOMBIE_DEF.get_staticdata = function(self)
|
|||
end
|
||||
|
||||
ZOMBIE_DEF.on_activate = function(self, staticdata, dtime_s)
|
||||
z_update_visuals_def(self)
|
||||
z_init_visuals(self)
|
||||
self.anim = z_get_animations()
|
||||
self.object:set_animation({x=self.anim.stand_START,y=self.anim.stand_END}, z_animation_speed, 0)
|
||||
self.npc_anim = ANIM_STAND
|
||||
|
@ -119,7 +115,6 @@ ZOMBIE_DEF.on_punch = function(self, puncher, time_from_last_punch, tool_capabil
|
|||
if not self.can_punch then return end
|
||||
|
||||
local my_pos = self.object:getpos()
|
||||
|
||||
if puncher ~= nil then
|
||||
self.attacker = puncher
|
||||
if time_from_last_punch >= 0.45 then
|
||||
|
|
Loading…
Reference in New Issue