workover spawning, less checks
This commit is contained in:
parent
063fbe48f2
commit
49c3daf2f8
18
init.lua
18
init.lua
@ -36,6 +36,7 @@ local nodename_water = minetest.registered_aliases.mapgen_water_source
|
||||
local maxwhales = 1
|
||||
local maxsharks = abo/2
|
||||
local maxmobs = 30
|
||||
local timer = 0
|
||||
|
||||
local abs = math.abs
|
||||
local pi = math.pi
|
||||
@ -49,8 +50,8 @@ local sign = math.sign
|
||||
|
||||
local time = os.time
|
||||
|
||||
local whale_spawn_rate = 0.01
|
||||
local shark_spawn_rate = 0.03
|
||||
local whale_spawn_rate = 50
|
||||
local shark_spawn_rate = 150
|
||||
|
||||
|
||||
|
||||
@ -243,10 +244,15 @@ end
|
||||
|
||||
local function spawnstep(dtime)
|
||||
|
||||
timer = timer + dtime
|
||||
if timer > 5 then
|
||||
|
||||
for _,plyr in ipairs(minetest.get_connected_players()) do
|
||||
|
||||
local coin = random(1000)
|
||||
--minetest.chat_send_all(dump(coin))
|
||||
if plyr then -- each player gets a spawn chance every 5s on average
|
||||
|
||||
if plyr and random()<dtime*0.1 then -- each player gets a spawn chance every 5s on average
|
||||
local pos = plyr:get_pos()
|
||||
local yaw = plyr:get_look_horizontal()
|
||||
local chance = shark_spawn_rate
|
||||
@ -273,7 +279,7 @@ local function spawnstep(dtime)
|
||||
|
||||
|
||||
local mobname = 'water_life:shark'
|
||||
if chance < random() then
|
||||
if shark_spawn_rate >= coin then
|
||||
pos2.y = height+1.01
|
||||
|
||||
local a=pos2.x
|
||||
@ -291,7 +297,7 @@ local function spawnstep(dtime)
|
||||
end
|
||||
|
||||
|
||||
if whale_spawn_rate < random() then
|
||||
if whale_spawn_rate >= coin then
|
||||
pos2.y = height+4.01
|
||||
|
||||
mobname = 'water_life:whale'
|
||||
@ -312,6 +318,8 @@ local function spawnstep(dtime)
|
||||
end
|
||||
end
|
||||
end
|
||||
timer = 0
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user