Update creatures mod

master
BlockMen 2015-09-19 16:41:38 +02:00
parent fce0abcc7f
commit c26b4e60c1
11 changed files with 87 additions and 26 deletions

45
mods/creatures/README.txt Normal file
View File

@ -0,0 +1,45 @@
Minetest mod "Creatures"
=======================
by BlockMen (c) 2014 - 2015
Version: 1.1.5 (Wasteland Edition)
About
~~~~~
This mod zombies to Wasteland.
Zombies can spawn to every day-time in the world as long there is not to much light.
So you will find some in caves, dark forests and ofc a lot at night. If they notice you they will attack.
Zombies have 20 HP (like players) and drop rotten flesh randomly.
They can't harm you in your house (in case there is no door open). If it becomes day both mobs will take damage
by the sunlight, so they will die after a while.
Notice: Weapons and tools get damaged when hitting a zombie. The wearout is calculated on the damage amout
of the tools/weapons. The more damage they can do that longer they can be used.
Example:
- Diamond Sword: 551 uses
- Wooden Sword: 30 uses
License of source code, textures and mesh model: WTFPL
------------------------------------------------------
(c) Copyright BlockMen 2014 - 2015
Licenses of sounds
------------------
following sounds are created by Under7dude (freesound.org)
- creatures_zombie.1.ogg, CC0
- creatures_zombie.2.ogg, CC0
- creatures_zombie.3.ogg, CC0
- creatures_zombie_death.ogg, CC0
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
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details.

View File

@ -1 +1,2 @@
default

View File

@ -23,7 +23,7 @@
minetest.register_craftitem("creatures:flesh", {
description = "Flesh",
inventory_image = "creatures_flesh.png",
on_use = minetest.item_eat(4),
on_use = minetest.item_eat(2),
stack_max = 60,
})
@ -34,6 +34,20 @@ minetest.register_craftitem("creatures:rotten_flesh", {
stack_max = 60,
})
-- food
minetest.register_craftitem("creatures:meat", {
description = "Cooked Meat",
inventory_image = "creatures_meat.png",
on_use = minetest.item_eat(4),
stack_max = 60,
})
minetest.register_craft({
type = "cooking",
output = "creatures:meat",
recipe = "creatures:flesh",
})
-- spawn-eggs
minetest.register_craftitem("creatures:zombie_spawn_egg", {
description = "Zombie spawn-egg",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 B

View File

@ -35,8 +35,8 @@ if not minetest.setting_getbool("only_peaceful_mobs") then
end
local n = minetest.get_node_or_nil(pos)
--if n and n.name and n.name ~= "default:stone" and math.random(1,4)>3 then return end
pos.y = pos.y+1
local ll = minetest.get_node_light(pos) or nil
pos.y = pos.y + 1
local ll = minetest.get_node_light(pos)
if not ll then
return
end
@ -46,13 +46,16 @@ if not minetest.setting_getbool("only_peaceful_mobs") then
if ll < -1 then
return
end
if not minetest.get_node(pos).walkable then
return
end
pos.y = pos.y + 1
if minetest.get_node(pos).name ~= "air" then
return
end
pos.y = pos.y+1
if minetest.get_node(pos).name ~= "air" then
return
end
creatures.spawn(pos, math.random(1,3), "creatures:zombie", 2, 20)
pos.y = pos.y - 1
creatures.spawn(pos, math.random(1, 3), "creatures:zombie", 2, 20)
end})
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

View File

@ -35,7 +35,10 @@ local z_sound_normal = "creatures_zombie"
local z_sound_hit = "creatures_zombie_hit"
local z_sound_dead = "creatures_zombie_death"
creatures.z_spawn_nodes = {"default:dry_dirt","default:dirt","default:mossycobble", "default:stone","default:dirt","default:desert_sand"}
creatures.z_spawn_nodes = {
"default:dirt_with_grass","default:dirt","default:mossycobble",
"default:stone","default:dirt","default:desert_sand"
}
creatures.z_spawner_range = 17
creatures.z_spawner_max_mobs = 6
@ -56,24 +59,20 @@ end
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:set_animation({x=self.anim.walk_START,y=self.anim.walk_END}, 35, 0)
self.npc_anim = creatures.ANIM_WALK
minetest.sound_play(sound, {pos = self.object:getpos(), max_hear_distance = 18, loop = false, gain = 0.4})
self.object:settexturemod("^[colorize:#c4000099")
self.can_punch = false
self.object:set_animation({x = self.anim.walk_START, y = self.anim.walk_END}, 35, 0)
self.npc_anim = creatures.ANIM_WALK
minetest.after(0.4, function()
z_update_visuals_def(self)
self.can_punch = true
self.object:settexturemod("")
self.npc_anim = ""
end)
end
function z_update_visuals_def(self)
self.can_punch = true
prop = {
function z_init_visuals(self)
local prop = {
mesh = z_mesh,
textures = z_texture,
}
@ -116,10 +115,10 @@ 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
self.npc_anim = creatures.ANIM_STAND
self.object:setacceleration({x=0,y=-20,z=0})
self.state = 1
self.object:set_hp(z_hp)
@ -143,7 +142,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
@ -243,7 +241,7 @@ ZOMBIE_DEF.on_step = function(self, dtime)
-- play random sound
if self.sound_timer > math.random(5,35) then
minetest.sound_play(z_sound_normal, {pos = current_pos, max_hear_distance = 10, gain = 0.7})
minetest.sound_play(z_sound_normal, {pos = current_pos, max_hear_distance = 18, gain = 0.7})
self.sound_timer = 0
end
@ -351,7 +349,7 @@ ZOMBIE_DEF.on_step = function(self, dtime)
--jump
local p = current_pos
p.y = p.y-0.5
creatures.jump(self, p, 7, 0.25)
creatures.jump(self, p, 7.4, 0.25)
if self.attacker ~= "" and minetest.setting_getbool("enable_damage") then
local s = current_pos