Revised activation system.
parent
412b2980ec
commit
d6520aaf3c
|
@ -61,6 +61,10 @@
|
|||
<td class="summary">Activates the voice system.</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>
|
||||
<td class="name" nowrap><a href="#in_range">in_range (distance, range, line_of_sight)</a></td>
|
||||
<td class="summary">Checks if the given distance is in the given range, considering
|
||||
the line of sight.</td>
|
||||
|
@ -128,6 +132,18 @@
|
|||
<td class="summary">Type constant for a whispered message.</td>
|
||||
</tr>
|
||||
<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>
|
||||
<td class="name" nowrap><a href="#global_privilege">global_privilege</a></td>
|
||||
<td class="summary">The privilege that is needed for using the global command.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#line_of_sight_mod">line_of_sight_mod</a></td>
|
||||
<td class="summary">The line of sight modification, which means that if the target does not
|
||||
have line of sight with the source, this mod will be applied to
|
||||
|
@ -138,10 +154,6 @@
|
|||
<td class="summary">The callbacks for when a message is send.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#pseudo_random">pseudo_random</a></td>
|
||||
<td class="summary">The source for random chances when modifying messages.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#understandable">understandable</a></td>
|
||||
<td class="summary">Everything within this range (inclusive) will be understandable.</td>
|
||||
</tr>
|
||||
|
@ -207,6 +219,20 @@
|
|||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "activate_internal"></a>
|
||||
<strong>activate_internal ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Activates the system, without checking the configuration.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "in_range"></a>
|
||||
|
@ -577,6 +603,48 @@
|
|||
|
||||
|
||||
|
||||
</dd>
|
||||
<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>
|
||||
<a name = "global_privilege"></a>
|
||||
<strong>global_privilege</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
The privilege that is needed for using the global command.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "line_of_sight_mod"></a>
|
||||
|
@ -607,20 +675,6 @@
|
|||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "pseudo_random"></a>
|
||||
<strong>pseudo_random</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
The source for random chances when modifying messages.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "understandable"></a>
|
||||
|
|
|
@ -41,6 +41,12 @@ voice = {
|
|||
--- Type constant for a whispered message.
|
||||
TYPE_WHISPER = "whisper",
|
||||
|
||||
--- If the system should be activated automatically.
|
||||
activate_automatically = settings.get_bool("voice_activate", true),
|
||||
|
||||
--- If the system is active/has been activated.
|
||||
active = false,
|
||||
|
||||
--- The privilege that is needed for using the global command.
|
||||
global_privilege = settings.get_string("voice_global_privilege", "voice_global"),
|
||||
|
||||
|
@ -136,7 +142,14 @@ end
|
|||
|
||||
--- Activates the voice system.
|
||||
function voice.activate()
|
||||
if settings.get_bool("voice_activate", true) then
|
||||
if voice.activate_automatically then
|
||||
voice.activate_internal()
|
||||
end
|
||||
end
|
||||
|
||||
--- Activates the system, without checking the configuration.
|
||||
function voice.activate_internal()
|
||||
if not voice.active then
|
||||
minetest.register_privilege(voice.global_privilege, {
|
||||
description = "The privilege needed to use the global chat.",
|
||||
give_to_singleplayer = true
|
||||
|
@ -148,6 +161,8 @@ function voice.activate()
|
|||
voice.register_chatcommand("s", "shout", "Shout", voice.shout_parameters)
|
||||
voice.register_chatcommand("w", "whisper", "Whisper", voice.whisper_parameters)
|
||||
voice.register_global_chatcommand()
|
||||
|
||||
voice.active = true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue