Compare commits
5 Commits
092a268363
...
00b222e63d
Author | SHA1 | Date |
---|---|---|
Robert Zenz | 00b222e63d | |
Robert Zenz | d8e558aaed | |
Robert Zenz | 4e0ecdd03e | |
Robert Zenz | 90f83e7732 | |
Robert Zenz | 817dee24c8 |
19
README
19
README
|
@ -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.
|
# If the system should be activated, defaults to true.
|
||||||
spawnusher_activate = 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.
|
# 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.
|
# 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
|
# If you want to avoid spawns in caves, this value needs to be increased
|
||||||
# to a sensible value.
|
# to a sensible value.
|
||||||
spawnusher_bubble_size = 2
|
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,
|
# 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
|
# this amount of time will be waited before it is retried to place
|
||||||
# place the player, defaults to 0.5.
|
# place the player, defaults to 0.5.
|
||||||
|
@ -106,6 +110,13 @@ Usage example:
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
Force activation
|
||||||
|
----------------
|
||||||
|
|
||||||
|
You can force the activation of the system, even if it has been disabled in
|
||||||
|
the configuration, by invoking `spawnusher.activate_internal`.
|
||||||
|
|
||||||
|
|
||||||
Caveats
|
Caveats
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,10 @@
|
||||||
<td class="name" nowrap><a href="#activate">activate ()</a></td>
|
<td class="name" nowrap><a href="#activate">activate ()</a></td>
|
||||||
<td class="summary">Activates the spawn usher system, if it has not been deactivated by
|
<td class="summary">Activates the spawn usher system, if it has not been deactivated by
|
||||||
a seeting in the configuration.</td>
|
a seeting in the configuration.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="name" nowrap><a href="#activate_internal">activate_internal ()</a></td>
|
||||||
|
<td class="summary">Activates the system, without checking the configuration.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="name" nowrap><a href="#is_air_bubble">is_air_bubble (start_pos)</a></td>
|
<td class="name" nowrap><a href="#is_air_bubble">is_air_bubble (start_pos)</a></td>
|
||||||
|
@ -110,6 +114,14 @@
|
||||||
</table>
|
</table>
|
||||||
<h2><a href="#Fields">Fields</a></h2>
|
<h2><a href="#Fields">Fields</a></h2>
|
||||||
<table class="function_list">
|
<table class="function_list">
|
||||||
|
<tr>
|
||||||
|
<td class="name" nowrap><a href="#activate_automatically">activate_automatically</a></td>
|
||||||
|
<td class="summary">If the system should be activated automatically.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="name" nowrap><a href="#active">active</a></td>
|
||||||
|
<td class="summary">If the system is active/has been activated.</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="name" nowrap><a href="#after_spawn_callbacks">after_spawn_callbacks</a></td>
|
<td class="name" nowrap><a href="#after_spawn_callbacks">after_spawn_callbacks</a></td>
|
||||||
<td class="summary">The list of callbacks that are invoked after the player has been placed.</td>
|
<td class="summary">The list of callbacks that are invoked after the player has been placed.</td>
|
||||||
|
@ -119,8 +131,8 @@
|
||||||
<td class="summary">The list of players that need to be placed.</td>
|
<td class="summary">The list of players that need to be placed.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="name" nowrap><a href="#random">random</a></td>
|
<td class="name" nowrap><a href="#random_direction">random_direction</a></td>
|
||||||
<td class="summary">The random object that is used to get random values.</td>
|
<td class="summary">If the player should be facing a random direction after spawning.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="name" nowrap><a href="#random_placement_radius">random_placement_radius</a></td>
|
<td class="name" nowrap><a href="#random_placement_radius">random_placement_radius</a></td>
|
||||||
|
@ -168,6 +180,21 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
<a name = "activate_internal"></a>
|
||||||
|
<strong>activate_internal ()</strong>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
Activates the system, without checking the configuration. Multiple
|
||||||
|
invokations have no effect.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<a name = "is_air_bubble"></a>
|
<a name = "is_air_bubble"></a>
|
||||||
|
@ -400,6 +427,34 @@
|
||||||
</dl>
|
</dl>
|
||||||
<h2><a name="Fields"></a>Fields</h2>
|
<h2><a name="Fields"></a>Fields</h2>
|
||||||
<dl class="function">
|
<dl class="function">
|
||||||
|
<dt>
|
||||||
|
<a name = "activate_automatically"></a>
|
||||||
|
<strong>activate_automatically</strong>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
If the system should be activated automatically.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
<a name = "active"></a>
|
||||||
|
<strong>active</strong>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
If the system is active/has been activated.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<a name = "after_spawn_callbacks"></a>
|
<a name = "after_spawn_callbacks"></a>
|
||||||
<strong>after_spawn_callbacks</strong>
|
<strong>after_spawn_callbacks</strong>
|
||||||
|
@ -429,11 +484,11 @@
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<a name = "random"></a>
|
<a name = "random_direction"></a>
|
||||||
<strong>random</strong>
|
<strong>random_direction</strong>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
The random object that is used to get random values.
|
If the player should be facing a random direction after spawning.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
--
|
--
|
||||||
-- The only function that should be called from clients is activate.
|
-- The only function that should be called from clients is activate.
|
||||||
spawnusher = {
|
spawnusher = {
|
||||||
|
--- If the system should be activated automatically.
|
||||||
|
activate_automatically = settings.get_bool("spawnusher_activate", true),
|
||||||
|
|
||||||
|
--- If the system is active/has been activated.
|
||||||
|
active = false,
|
||||||
|
|
||||||
--- The list of callbacks that are invoked after the player has been placed.
|
--- The list of callbacks that are invoked after the player has been placed.
|
||||||
after_spawn_callbacks = List:new(),
|
after_spawn_callbacks = List:new(),
|
||||||
|
|
||||||
|
@ -54,6 +60,9 @@ spawnusher = {
|
||||||
--- The list of players that need to be placed.
|
--- The list of players that need to be placed.
|
||||||
players = List:new(),
|
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.
|
--- The placement radius around the spawn.
|
||||||
random_placement_radius = settings.get_number("spawnusher_placement_radius", 40),
|
random_placement_radius = settings.get_number("spawnusher_placement_radius", 40),
|
||||||
|
|
||||||
|
@ -81,9 +90,19 @@ spawnusher = {
|
||||||
--- Activates the spawn usher system, if it has not been deactivated by
|
--- Activates the spawn usher system, if it has not been deactivated by
|
||||||
-- a seeting in the configuration.
|
-- a seeting in the configuration.
|
||||||
function spawnusher.activate()
|
function spawnusher.activate()
|
||||||
if settings.get_bool("spawnusher_activate", true) then
|
if spawnusher.activate_automatically then
|
||||||
|
spawnusher.activate_internal()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Activates the system, without checking the configuration. Multiple
|
||||||
|
-- invokations have no effect.
|
||||||
|
function spawnusher.activate_internal()
|
||||||
|
if not spawnusher.active then
|
||||||
minetest.register_on_newplayer(spawnusher.on_spawn_player)
|
minetest.register_on_newplayer(spawnusher.on_spawn_player)
|
||||||
minetest.register_on_respawnplayer(spawnusher.on_spawn_player)
|
minetest.register_on_respawnplayer(spawnusher.on_spawn_player)
|
||||||
|
|
||||||
|
spawnusher.active = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -180,8 +199,10 @@ function spawnusher.move_player(player)
|
||||||
-- Awesome! Place the user here.
|
-- Awesome! Place the user here.
|
||||||
player:setpos(pos)
|
player:setpos(pos)
|
||||||
|
|
||||||
-- Randomize the direction in which the player looks.
|
if spawnusher.random_direction then
|
||||||
player:set_look_yaw(math.rad(random.next_int(0, 360)))
|
-- Randomize the direction in which the player looks.
|
||||||
|
player:set_look_yaw(math.rad(random.next_int(0, 360)))
|
||||||
|
end
|
||||||
|
|
||||||
-- Reset the physics override.
|
-- Reset the physics override.
|
||||||
player:set_physics_override(spawnusher.player_physics[player:get_player_name()])
|
player:set_physics_override(spawnusher.player_physics[player:get_player_name()])
|
||||||
|
|
Loading…
Reference in New Issue