Add Minauros and zombies (only there).

master
Duane 2016-06-08 00:45:26 -05:00
parent d22195be27
commit 10bb057f61
19 changed files with 5781 additions and 56 deletions

View File

@ -107,6 +107,12 @@ minetest.register_globalstep(function(dtime)
player:set_hp(player:get_hp() - 1)
end
-- Environmental damage from surfaces/hunger
local counts = find_nodes_in_area(minp, maxp, {"group:poison"})
if #counts > 1 then
player:set_hp(player:get_hp() - 1)
end
if dps_count % cold_delay == 0 then
counts = find_nodes_in_area(minp, maxp, {"group:surface_cold"})
if #counts > 1 then

View File

@ -114,6 +114,74 @@ minetest.register_decoration({
decoration = "default:junglegrass",
})
-- Create and initialize a table for a schematic.
function fun_caves.schematic_array(width, height, depth)
-- Dimensions of data array.
local s = {size={x=width, y=height, z=depth}}
s.data = {}
for z = 0,depth-1 do
for y = 0,height-1 do
for x = 0,width-1 do
local i = z*width*height + y*width + x + 1
s.data[i] = {}
s.data[i].name = "air"
s.data[i].param1 = 000
end
end
end
s.yslice_prob = {}
return s
end
fun_caves.schematics = {}
do
local w, h, d = 5, 8, 5
local s = fun_caves.schematic_array(w, h, d)
for y = 0, math.floor(h/2)-1 do
s.data[2*d*h + y*d + 2 + 1].name = 'default:tree'
s.data[2*d*h + y*d + 2 + 1].param1 = 255
end
for z = 0, d-1 do
for y = math.floor(h/2), h-1 do
for x = 0, w-1 do
if y < h - 1 or (x ~= 0 and x ~= w-1 and z ~= 0 and z ~= d-1) then
if math.random(2) == 1 then
s.data[z*d*h + y*d + x + 1].name = 'fun_caves:leaves_black'
else
s.data[z*d*h + y*d + x + 1].name = 'fun_caves:sticks_default'
end
if y == h-1 or x == 0 or x == w-1 or z == 0 or z == d-1 then
s.data[z*d*h + y*d + x + 1].param1 = 150
else
s.data[z*d*h + y*d + x + 1].param1 = 225
end
end
end
end
end
for z = math.floor(d/2)-1, math.floor(d/2)+1, 2 do
for x = math.floor(w/2)-1, math.floor(w/2)+1, 2 do
s.data[z*d*h + math.floor(h/2)*d + x + 1].name = 'default:tree'
s.data[z*d*h + math.floor(h/2)*d + x + 1].param1 = 150
end
end
for y = 0, h-1 do
if y / 3 == math.floor(y / 3) then
s.yslice_prob[#s.yslice_prob+1] = {ypos=y,prob=170}
end
end
fun_caves.schematics['decaying_tree'] = s
end
dofile(fun_caves.path .. "/deco_caves.lua")
--dofile(fun_caves.path.."/deco_dirt.lua")

View File

@ -26,8 +26,61 @@ local min = math.min
local log = math.log
local floor = math.floor
local find_nodes_in_area = minetest.find_nodes_in_area
local csize
local function place_schematic(minp, maxp, data, p2data, area, node, pos, schem, center)
local rot = rand(4) - 1
local yslice = {}
if schem.yslice_prob then
for _, ys in pairs(schem.yslice_prob) do
yslice[ys.ypos] = ys.prob
end
end
if center then
pos.x = pos.x - floor(schem.size.x / 2)
pos.z = pos.z - floor(schem.size.z / 2)
end
for z1 = 0, schem.size.z - 1 do
for x1 = 0, schem.size.x - 1 do
local x, z
if rot == 0 then
x, z = x1, z1
elseif rot == 1 then
x, z = schem.size.z - z1 - 1, x1
elseif rot == 2 then
x, z = schem.size.x - x1 - 1, schem.size.z - z1 - 1
elseif rot == 3 then
x, z = z1, schem.size.x - x1 - 1
end
local dz = pos.z - minp.z + z
local dx = pos.x - minp.x + x
if pos.x + x > minp.x and pos.x + x < maxp.x and pos.z + z > minp.z and pos.z + z < maxp.z then
local ivm = area:index(pos.x + x, pos.y, pos.z + z)
local isch = z1 * schem.size.y * schem.size.x + x1 + 1
for y = 0, schem.size.y - 1 do
local dy = pos.y - minp.y + y
--if math.min(dx, csize.x - dx) + math.min(dy, csize.y - dy) + math.min(dz, csize.z - dz) > bevel then
if yslice[y] or 255 >= rand(255) then
local prob = schem.data[isch].prob or schem.data[isch].param1 or 255
if prob >= rand(255) and schem.data[isch].name ~= "air" then
data[ivm] = node[schem.data[isch].name]
end
local param2 = schem.data[isch].param2 or 0
p2data[ivm] = param2
end
--end
ivm = ivm + area.ystride
isch = isch + schem.size.x
end
end
end
end
end
local function surround(node, data, area, ivm)
-- Check to make sure that a plant root is fully surrounded.
-- This is due to the kludgy way you have to make water plants
@ -55,7 +108,7 @@ local plant_noise = {offset = 0.0, scale = 1.0, spread = {x = 200, y = 200, z =
-- Air needs to be placed prior to decorations.
fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, biome_ids, underzone, dis_map)
local csize = vector.add(vector.subtract(maxp, minp), 1)
csize = vector.add(vector.subtract(maxp, minp), 1)
local biomemap = minetest.get_mapgen_object("biomemap")
local map_max = {x = csize.x, y = csize.y + 2, z = csize.z}
local map_min = {x = minp.x, y = minp.y - 1, z = minp.z}
@ -106,6 +159,12 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi
elseif underzone == 3 then
stone_type = node["fun_caves:hot_brass"]
stone_depth = 1
elseif underzone == 4 and y % 4960 <= 145 then
stone_type = node["fun_caves:polluted_dirt"]
stone_depth = 2
elseif underzone == 4 and y % 4960 > 145 then
stone_type = node["fun_caves:black_sand"]
stone_depth = 2
elseif underzone == 6 then
stone_type = node["default:dirt"]
stone_depth = 2
@ -268,6 +327,10 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi
data[ivm] = node["default:lava_source"]
write = true
break
elseif node_below == node["fun_caves:polluted_dirt"] and rand(400) == 1 then
data[ivm] = node["fun_caves:water_poison_source"]
write = true
break
elseif node_below == node["fun_caves:stone_with_moss"] and rand(300) == 1 then
data[ivm] = node["default:water_source"]
write = true
@ -302,6 +365,24 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi
break
-- vegetation
elseif node_below == node["fun_caves:polluted_dirt"] then
if rand(10) == 1 then
data[ivm] = node["default:dry_shrub"]
write = true
break
elseif rand(50) == 1 then
local air_count = 0
local j
for i = 1, 9 do
j = ivm + area.ystride * i
if j <= #data and data[j] == node["air"] then
air_count = air_count + 1
end
end
if air_count > 6 then
place_schematic(minp, maxp, data, p2data, area, node, {x=x,y=y,z=z}, fun_caves.schematics['decaying_tree'], true)
end
end
elseif node_below == node["default:dirt"] and (stone_type == node["fun_caves:stone_with_lichen"] or stone_type == node["fun_caves:stone_with_algae"]) and biome_val >= -0.5 then
if rand(10) == 1 then
data[ivm] = node["flowers:mushroom_red"]

View File

@ -29,58 +29,6 @@ for name, desc in pairs(minetest.registered_biomes) do
biome_ids[get_biome_id(desc.name)] = desc.name
end
--local function place_schematic(pos, schem, center)
-- local rot = rand(4) - 1
-- local yslice = {}
-- if schem.yslice_prob then
-- for _, ys in pairs(schem.yslice_prob) do
-- yslice[ys.ypos] = ys.prob
-- end
-- end
--
-- if center then
-- pos.x = pos.x - floor(schem.size.x / 2)
-- pos.z = pos.z - floor(schem.size.z / 2)
-- end
--
-- for z1 = 0, schem.size.z - 1 do
-- for x1 = 0, schem.size.x - 1 do
-- local x, z
-- if rot == 0 then
-- x, z = x1, z1
-- elseif rot == 1 then
-- x, z = schem.size.z - z1 - 1, x1
-- elseif rot == 2 then
-- x, z = schem.size.x - x1 - 1, schem.size.z - z1 - 1
-- elseif rot == 3 then
-- x, z = z1, schem.size.x - x1 - 1
-- end
-- local dz = pos.z - minp.z + z
-- local dx = pos.x - minp.x + x
-- if pos.x + x > minp.x and pos.x + x < maxp.x and pos.z + z > minp.z and pos.z + z < maxp.z then
-- local ivm = area:index(pos.x + x, pos.y, pos.z + z)
-- local isch = z1 * schem.size.y * schem.size.x + x1 + 1
-- for y = 0, schem.size.y - 1 do
-- local dy = pos.y - minp.y + y
-- if math.min(dx, csize.x - dx) + math.min(dy, csize.y - dy) + math.min(dz, csize.z - dz) > bevel then
-- if yslice[y] or 255 >= rand(255) then
-- local prob = schem.data[isch].prob or schem.data[isch].param1 or 255
-- if prob >= rand(255) and schem.data[isch].name ~= "air" then
-- data[ivm] = node[schem.data[isch].name]
-- end
-- local param2 = schem.data[isch].param2 or 0
-- p2data[ivm] = param2
-- end
-- end
--
-- ivm = ivm + area.ystride
-- isch = isch + schem.size.x
-- end
-- end
-- end
-- end
--end
--local function get_decoration(biome)
-- for i, deco in pairs(fun_caves.decorations) do
-- if not deco.biomes or deco.biomes[biome] then

View File

@ -293,6 +293,8 @@ if minetest.registered_entities["mobs_sharks:shark_lg"] then
mobs:register_egg("fun_caves:shark_md", "Shark (giant)", "mob_shark_shark_item.png", 0)
end
dofile(fun_caves.path.."/zombie.lua")
fun_caves.goblin_spawn_frequency = 150
fun_caves.goblin_trap_freq = 25
@ -330,6 +332,8 @@ local t_mobs = {
"fun_caves:goblin_gold",
"fun_caves:goblin_diamond",
"fun_caves:goblin_king",
"fun_caves:zombie",
"fun_caves:zombie",
"dmobs:orc",
"dmobs:orc",
"dmobs:orc",

5524
models/creatures_mob.x Normal file

File diff suppressed because it is too large Load Diff

View File

@ -16,21 +16,27 @@ newnode.drop = "default:dirt"
newnode.groups.soil = 0
minetest.register_node("fun_caves:dirt", newnode)
newnode = fun_caves.clone_node("default:dirt")
newnode.description = "Polluted Dirt"
newnode.tiles = {"default_dirt.png^[colorize:#100020:100"}
newnode.groups.soil = 0
minetest.register_node("fun_caves:polluted_dirt", newnode)
-- dungeon floor, basic
local newnode = fun_caves.clone_node("default:stone")
newnode = fun_caves.clone_node("default:stone")
newnode.description = "Dungeon Stone"
newnode.legacy_mineral = false
newnode.groups = {fortress = 1}
minetest.register_node("fun_caves:dungeon_floor_1", newnode)
-- dungeon walls, basic
local newnode = fun_caves.clone_node("default:sandstone")
newnode = fun_caves.clone_node("default:sandstone")
newnode.description = "Dungeon Stone"
newnode.groups = {fortress = 1}
minetest.register_node("fun_caves:dungeon_wall_1", newnode)
-- dungeon walls, type 2
local newnode = fun_caves.clone_node("default:desert_stone")
newnode = fun_caves.clone_node("default:desert_stone")
newnode.description = "Dungeon Stone"
newnode.groups = {fortress = 1}
minetest.register_node("fun_caves:dungeon_wall_2", newnode)
@ -65,6 +71,33 @@ minetest.register_node('fun_caves:sticks_default', {
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
})
newnode = fun_caves.clone_node("default:leaves")
newnode.description = "Blackened Leaves"
newnode.tiles = {"default_leaves.png^[colorize:#100020:200"}
newnode.special_tiles = {"default_leaves_simple.png^[colorize:#100020:200"}
newnode.groups = {snappy = 3, flammable = 2}
minetest.register_node("fun_caves:leaves_black", newnode)
newnode = fun_caves.clone_node("default:water_source")
newnode.description = "Poisonous Water"
newnode.tiles[1].name = "fun_caves_water_poison_source_animated.png"
newnode.special_tiles[1].name = "fun_caves_water_poison_source_animated.png"
newnode.liquid_alternative_flowing = "fun_caves:water_poison_flowing"
newnode.liquid_alternative_source = "fun_caves:water_poison_source"
newnode.light_source = 6
newnode.groups.poison = 3
minetest.register_node("fun_caves:water_poison_source", newnode)
newnode = fun_caves.clone_node("default:water_flowing")
newnode.description = "Poisonous Water"
newnode.tiles[1] = "fun_caves_water_poison.png"
newnode.special_tiles[1].name = "fun_caves_water_poison_flowing_animated.png"
newnode.liquid_alternative_flowing = "fun_caves:water_poison_flowing"
newnode.liquid_alternative_source = "fun_caves:water_poison_source"
newnode.light_source = 6
newnode.groups.poison = 3
minetest.register_node("fun_caves:water_poison_flowing", newnode)
--minetest.register_node("fun_caves:bright_air", {
-- drawtype = "glasslike",
-- tiles = {"technic_light.png"},

BIN
sounds/mobs_zombie.1.ogg Normal file

Binary file not shown.

BIN
sounds/mobs_zombie.2.ogg Normal file

Binary file not shown.

BIN
sounds/mobs_zombie.3.ogg Normal file

Binary file not shown.

Binary file not shown.

BIN
sounds/mobs_zombie_hit.ogg Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

BIN
textures/mobs_zombie.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
textures/zombie_head.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

61
zombie.lua Normal file
View File

@ -0,0 +1,61 @@
-- Originally by Blockmen(?)
if mobs.mod and mobs.mod == "redo" then
mobs:register_mob("fun_caves:zombie", {
type = "monster",
visual = "mesh",
mesh = "creatures_mob.x",
textures = {
{"mobs_zombie.png"},
},
collisionbox = {-0.25, -1, -0.3, 0.25, 0.75, 0.3},
animation = {
speed_normal = 10, speed_run = 15,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 188,
run_start = 168, run_end = 188
},
makes_footstep_sound = true,
sounds = {
random = "mobs_zombie.1",
war_cry = "mobs_zombie.3",
attack = "mobs_zombie.2",
damage = "mobs_zombie_hit",
death = "mobs_zombie_death",
},
hp_min = 12,
hp_max = 35,
armor = 200,
knock_back = 1,
lava_damage = 10,
damage = 4,
reach = 2,
attack_type = "dogfight",
group_attack = true,
view_range = 10,
walk_chance = 75,
walk_velocity = 0.5,
run_velocity = 0.5,
jump = false,
drops = {
{name = "mobs_zombie:rotten_flesh", chance = 1, min = 1, max = 3,}
},
lifetimer = 180, -- 3 minutes
shoot_interval = 135, -- (lifetimer - (lifetimer / 4)), borrowed for do_custom timer
})
--name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height
mobs:spawn_specific("fun_caves:zombie",
{"fun_caves:polluted_dirt"},
{"air", "fun_caves:water_poison_flowing"},
-1, 20, 30, 2000, 2, -31000, 0)
mobs:register_egg("fun_caves:zombie", "Zombie", "zombie_head.png", 0)
-- rotten flesh
minetest.register_craftitem("fun_caves:rotten_flesh", {
description = "Rotten Flesh",
inventory_image = "mobs_rotten_flesh.png",
on_use = minetest.item_eat(1),
})
end