Clean up a little
This commit is contained in:
parent
106ef18be6
commit
265cd6a554
@ -324,13 +324,9 @@ function creatures.register_spawn(spawn_def)
|
||||
chance = spawn_def.abm_chance or 7000,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
-- prevent abm-"feature"
|
||||
if stopABMFlood() then
|
||||
if stopABMFlood() == true then
|
||||
return
|
||||
end
|
||||
-- if time_taker == 0 then
|
||||
-- return
|
||||
-- end
|
||||
-- time_taker = 0
|
||||
|
||||
-- time check
|
||||
local tod = core.get_timeofday() * 24000
|
||||
@ -341,14 +337,12 @@ function creatures.register_spawn(spawn_def)
|
||||
wanted_res = true
|
||||
end
|
||||
if inRange(range, tod) == wanted_res then
|
||||
print(spawn_def.mob_name .. " - tod" .. dump(spawn_def.time_range) .. " " .. dump(tod))
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- position check
|
||||
if spawn_def.height_limit and not inRange(spawn_def.height_limit, pos.y) then
|
||||
print("height")
|
||||
return
|
||||
end
|
||||
|
||||
@ -356,7 +350,6 @@ function creatures.register_spawn(spawn_def)
|
||||
pos.y = pos.y + 1
|
||||
local llvl = core.get_node_light(pos)
|
||||
if spawn_def.light and not inRange(spawn_def.light, llvl) then
|
||||
print("light")
|
||||
return
|
||||
end
|
||||
-- creature count check
|
||||
@ -364,11 +357,9 @@ function creatures.register_spawn(spawn_def)
|
||||
if active_object_count_wider > (spawn_def.max_number or 1) then
|
||||
local mates_num = #creatures.findTarget(nil, pos, 16, "mate", spawn_def.mob_name, true)
|
||||
if (mates_num or 0) >= spawn_def.max_number then
|
||||
-- print("too much")
|
||||
return
|
||||
else
|
||||
max = spawn_def.max_number - mates_num
|
||||
-- return
|
||||
end
|
||||
end
|
||||
|
||||
@ -396,7 +387,6 @@ function creatures.register_spawn(spawn_def)
|
||||
end
|
||||
core.add_entity(pos, spawn_def.mob_name)
|
||||
end
|
||||
print("spawned " .. spawn_def.mob_name .. " " .. number .. " ToD:"..tod)
|
||||
end,
|
||||
})
|
||||
|
||||
@ -496,8 +486,11 @@ local function spawnerSpawn(pos, spawner_def)
|
||||
local walkable = core.registered_nodes[n.name].walkable or false
|
||||
p.y = p.y + 1
|
||||
if walkable and checkSpace(p, spawner_def.height) == true then
|
||||
cnt = cnt + 1
|
||||
core.add_entity(p, spawner_def.mob_name)
|
||||
local llvl = core.get_node_light(p)
|
||||
if not spawner_def.light or (spawner_def.light and inRange(spawner_def.light, llvl)) then
|
||||
cnt = cnt + 1
|
||||
core.add_entity(p, spawner_def.mob_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,2 +1,2 @@
|
||||
creatures
|
||||
default
|
||||
creatures
|
||||
|
@ -24,7 +24,7 @@ local def = {
|
||||
-- general
|
||||
name = "creatures:ghost",
|
||||
stats = {
|
||||
hp = 20,
|
||||
hp = 12,
|
||||
lifetime = 300, -- 5 Minutes
|
||||
can_burn = true,
|
||||
can_fly = true,
|
||||
@ -65,15 +65,14 @@ local def = {
|
||||
},
|
||||
|
||||
combat = {
|
||||
attack_damage = 2, -- in hp
|
||||
attack_speed = 1.1, -- time in seconds between hits
|
||||
attack_radius = 0.9, -- radius of hit range
|
||||
attack_damage = 2,
|
||||
attack_speed = 1.1,
|
||||
attack_radius = 0.9,
|
||||
|
||||
search_enemy = true,
|
||||
search_timer = 2,
|
||||
search_radius = 12, --in nodes
|
||||
search_type = "player", --types = {all, hostile, nonhostile, player, mates}
|
||||
--search_xray = false, -- can see through walls?
|
||||
search_radius = 12,
|
||||
search_type = "player",
|
||||
},
|
||||
|
||||
spawning = {
|
||||
@ -83,21 +82,21 @@ local def = {
|
||||
},
|
||||
abm_interval = 40,
|
||||
abm_chance = 7300,
|
||||
max_number = 1, -- per mapblock
|
||||
max_number = 1,
|
||||
number = 1,
|
||||
time_range = {min = 18500, max = 4000}, -- 0-24000
|
||||
time_range = {min = 18500, max = 4000},
|
||||
light = {min = 0, max = 8},
|
||||
height_limit = {min = 0, max = 80},
|
||||
|
||||
spawn_egg = {
|
||||
description = "Ghost Spawn-Egg",
|
||||
texture = "creatures_spawn_egg.png^[colorize:#27ca",
|
||||
texture = "creatures_egg_ghost.png",
|
||||
},
|
||||
|
||||
spawner = {
|
||||
range = 8, -- defines area withing mobs are spawned
|
||||
number = 6, -- maxmimum number of mobs spawned in area defined via range
|
||||
light = {min = 0, max = 8}, -- additional light check
|
||||
range = 8,
|
||||
number = 6,
|
||||
light = {min = 0, max = 8},
|
||||
}
|
||||
},
|
||||
|
||||
|
BIN
ghost/textures/creatures_egg_ghost.png
Normal file
BIN
ghost/textures/creatures_egg_ghost.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 718 B |
@ -1,4 +1,4 @@
|
||||
creatures
|
||||
default
|
||||
creatures
|
||||
farming?
|
||||
wool?
|
||||
|
@ -113,9 +113,9 @@ local def = {
|
||||
},
|
||||
abm_interval = 55,
|
||||
abm_chance = 7800,
|
||||
max_number = 1, -- per mapblock(16x16x16)
|
||||
max_number = 1,
|
||||
number = {min = 1, max = 3},
|
||||
time_range = {min = 5100, max = 18300}, -- 0-24000
|
||||
time_range = {min = 5100, max = 18300},
|
||||
light = {min = 10, max = 15},
|
||||
height_limit = {min = 0, max = 25},
|
||||
|
||||
@ -124,12 +124,12 @@ local def = {
|
||||
texture = "creatures_egg_sheep.png",
|
||||
},
|
||||
|
||||
spawner = {
|
||||
range = 8, -- defines area withing mobs are spawned
|
||||
player_range = 20, -- defines at what distance spawner gets activated
|
||||
number = 6, -- maxmimum number of mobs spawned in area defined via range
|
||||
light = {min = 2, max = 15}, -- additional light check
|
||||
}
|
||||
--[[spawner = {
|
||||
range = 8,
|
||||
player_range = 20,
|
||||
number = 6,
|
||||
light = {min = 2, max = 15},
|
||||
}]]
|
||||
},
|
||||
|
||||
on_punch = function(self, puncher)
|
||||
|
@ -1,2 +1,2 @@
|
||||
creatures
|
||||
default
|
||||
creatures
|
||||
|
@ -71,15 +71,14 @@ local def = {
|
||||
},
|
||||
|
||||
combat = {
|
||||
attack_damage = 1, -- in hp
|
||||
attack_speed = 0.6, -- time in seconds between hits
|
||||
attack_radius = 1.1, -- radius of hit range
|
||||
attack_damage = 1,
|
||||
attack_speed = 0.6,
|
||||
attack_radius = 1.1,
|
||||
|
||||
search_enemy = true,
|
||||
search_timer = 2,
|
||||
search_radius = 12, --in nodes
|
||||
search_type = "player", --types = {all, hostile, nonhostile, player, mates}
|
||||
--search_xray = false, -- can see through walls?
|
||||
search_radius = 12,
|
||||
search_type = "player",
|
||||
},
|
||||
|
||||
spawning = {
|
||||
@ -89,21 +88,20 @@ local def = {
|
||||
},
|
||||
abm_interval = 36,
|
||||
abm_chance = 7600,
|
||||
max_number = 1, -- per mapblock
|
||||
max_number = 1,
|
||||
number = 2,
|
||||
--time_range = {min = 18500, max = 4000}, -- 0-24000
|
||||
light = {min = 0, max = 8},
|
||||
height_limit = {min = -200, max = 50},
|
||||
|
||||
spawn_egg = {
|
||||
description = "Zombie Spawn-Egg",
|
||||
texture = "creatures_spawn_egg.png^[colorize:#2c9a",
|
||||
texture = "creatures_egg_zombie.png",
|
||||
},
|
||||
|
||||
spawner = {
|
||||
range = 8, -- defines area withing mobs are spawned
|
||||
number = 6, -- maxmimum number of mobs spawned in area defined via range
|
||||
light = {min = 0, max = 8}, -- additional light check
|
||||
range = 8,
|
||||
number = 6,
|
||||
light = {min = 0, max = 8},
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user