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