mirror of
https://git.minetest.land/Mineclonia/Mineclonia.git
synced 2024-11-27 22:52:59 +00:00
Set mob spawn chance to 2.5 and fix player respawn msg
This commit is contained in:
parent
9e57828958
commit
5a7952bf92
3 changed files with 21 additions and 15 deletions
|
@ -65,7 +65,7 @@ local remove_far = false
|
|||
local difficulty = tonumber(minetest.settings:get("mob_difficulty")) or 1.0
|
||||
local show_health = false
|
||||
local max_per_block = tonumber(minetest.settings:get("max_objects_per_block") or 99)
|
||||
local mobs_spawn_chance = tonumber(minetest.settings:get("mobs_spawn_chance") or 1)
|
||||
local mobs_spawn_chance = tonumber(minetest.settings:get("mobs_spawn_chance") or 2.5)
|
||||
|
||||
-- Peaceful mode message so players will know there are no monsters
|
||||
if peaceful_only then
|
||||
|
@ -3335,7 +3335,7 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
|
|||
nodenames = nodes,
|
||||
neighbors = neighbors,
|
||||
interval = interval,
|
||||
chance = max(1, (chance * mobs_spawn_chance)),
|
||||
chance = floor(max(1, chance * mobs_spawn_chance)),
|
||||
catch_up = false,
|
||||
action = spawn_abm_action,
|
||||
})
|
||||
|
|
|
@ -2,33 +2,37 @@ mcl_spawn = {}
|
|||
|
||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||
|
||||
-- Returns current spawn position of player.
|
||||
-- Returns current custom spawn position of player.
|
||||
-- Returns nil if player has no custom spawn position.
|
||||
-- If player is nil or not a player, the default spawn point is returned.
|
||||
-- The second return value is true if spawn point is player-chosen,
|
||||
-- false otherwise.
|
||||
mcl_spawn.get_spawn_pos = function(player)
|
||||
local spawn, custom_spawn
|
||||
local spawn, custom_spawn = nil, false
|
||||
if player ~= nil and player:is_player() then
|
||||
spawn = minetest.string_to_pos(player:get_attribute("mcl_beds:spawn"))
|
||||
custom_spawn = true
|
||||
local attr = player:get_attribute("mcl_beds:spawn")
|
||||
if attr ~= nil and attr ~= "" then
|
||||
spawn = minetest.string_to_pos(attr)
|
||||
custom_spawn = true
|
||||
end
|
||||
end
|
||||
if not spawn or spawn == "" then
|
||||
spawn = minetest.setting_get_pos("static_spawnpoint")
|
||||
custom_spawn = false
|
||||
end
|
||||
if not spawn then
|
||||
spawn = { x=0, y=0, z=0 }
|
||||
if mg_name == "flat" then
|
||||
spawn.y = mcl_vars.mg_bedrock_overworld_max + 5
|
||||
if not spawn or spawn == "" then
|
||||
local attr = player:get_attribute("mcl_spawn:first_spawn")
|
||||
if attr ~= nil and attr ~= "" then
|
||||
spawn = minetest.string_to_pos(attr)
|
||||
custom_spawn = false
|
||||
end
|
||||
custom_spawn = false
|
||||
end
|
||||
return spawn, custom_spawn
|
||||
end
|
||||
|
||||
-- Sets the player's spawn position to pos.
|
||||
-- Set pos to nil to clear the spawn position.
|
||||
mcl_spawn.set_spawn_pos = function(player, pos)
|
||||
mcl_spawn.set_spawn_pos = function(player, pos, type)
|
||||
if pos == nil then
|
||||
player:set_attribute("mcl_beds:spawn", "")
|
||||
else
|
||||
|
@ -39,7 +43,7 @@ end
|
|||
-- Respawn player at specified respawn position
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
local pos, custom_spawn = mcl_spawn.get_spawn_pos(player)
|
||||
if custom_spawn then
|
||||
if pos and custom_spawn then
|
||||
-- Check if bed is still there
|
||||
-- and the spawning position is free of solid or damaging blocks.
|
||||
local node_bed = minetest.get_node(pos)
|
||||
|
@ -65,5 +69,7 @@ minetest.register_on_respawnplayer(function(player)
|
|||
end)
|
||||
|
||||
minetest.register_on_newplayer(function(player)
|
||||
mcl_spawn.set_spawn_pos(player, player:get_pos())
|
||||
-- Remember where the player spawned first
|
||||
player:set_attribute("mcl_spawn:first_spawn", minetest.pos_to_string(player:get_pos()))
|
||||
end)
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ mobs_spawn (Spawn mobs naturally) bool true
|
|||
|
||||
# Controls the overall amount of mobs that spawn. The higher the number,
|
||||
# the less often mobs will spawn. This does not affect mob spawners.
|
||||
mobs_spawn_chance (Mob spawn chance) float 1.0 0.0
|
||||
mobs_spawn_chance (Mob spawn chance) float 2.5 0.0
|
||||
|
||||
# If enabled, only peaceful mobs will appear naturally. This does not
|
||||
# affect mob spawners.
|
||||
|
|
Loading…
Reference in a new issue