Added setting for if the player should face a random direction.

master
Robert Zenz 2015-12-17 23:18:46 +01:00
parent 092a268363
commit 817dee24c8
2 changed files with 15 additions and 6 deletions

12
README
View File

@ -28,16 +28,20 @@ The system can be configured by adding settings to the `minetest.conf`:
# If the system should be activated, defaults to true.
spawnusher_activate = true
# The radius around the spawnpoint in which the players will be randomly
# placed, defaults to 40.
spawnusher_placement_radius = 40.
# The size of the air bubble that is required for the player to be placed.
# Note that this is only the vertical size, defaults to 2.
# If you want to avoid spawns in caves, this value needs to be increased
# to a sensible value.
spawnusher_bubble_size = 2
# The radius around the spawnpoint in which the players will be randomly
# placed, defaults to 40.
spawnusher_placement_radius = 40.
# If the player should be rotatet so that they face a random direction
# after spawning, defaults to true.
spawnusher_random_direction = true
# If the player can not be placed because the block is currently not loaded,
# this amount of time will be waited before it is retried to place
# place the player, defaults to 0.5.

View File

@ -54,6 +54,9 @@ spawnusher = {
--- The list of players that need to be placed.
players = List:new(),
--- If the player should be facing a random direction after spawning.
random_direction = settings.get_bool("spawnusher_random_direction", true),
--- The placement radius around the spawn.
random_placement_radius = settings.get_number("spawnusher_placement_radius", 40),
@ -180,8 +183,10 @@ function spawnusher.move_player(player)
-- Awesome! Place the user here.
player:setpos(pos)
-- Randomize the direction in which the player looks.
player:set_look_yaw(math.rad(random.next_int(0, 360)))
if spawnusher.random_direction then
-- Randomize the direction in which the player looks.
player:set_look_yaw(math.rad(random.next_int(0, 360)))
end
-- Reset the physics override.
player:set_physics_override(spawnusher.player_physics[player:get_player_name()])