Revised activation system.
parent
d941893184
commit
207c420f7c
|
@ -79,6 +79,14 @@
|
|||
</table>
|
||||
<h2><a href="#Fields">Fields</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#activate">activate</a></td>
|
||||
<td class="summary">If the system should be automatically activated.</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="#attraction_acceleration">attraction_acceleration</a></td>
|
||||
<td class="summary">The acceleration that is used when the item enters the attraction
|
||||
|
@ -259,6 +267,34 @@
|
|||
</dl>
|
||||
<h2><a name="Fields"></a>Fields</h2>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "activate"></a>
|
||||
<strong>activate</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
If the system should be automatically activated.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "active"></a>
|
||||
<strong>active</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
If the system is active/has been activated.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "attraction_acceleration"></a>
|
||||
<strong>attraction_acceleration</strong>
|
||||
|
|
|
@ -27,6 +27,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
--- A system which allows to automatically pickup items which are on the ground.
|
||||
autopickup = {
|
||||
--- If the system should be automatically activated.
|
||||
activate = settings.get_bool("autopickup_activate", true),
|
||||
|
||||
--- If the system is active/has been activated.
|
||||
active = false,
|
||||
|
||||
--- The acceleration that is used when the item enters the attraction
|
||||
-- radius, defaults to "2, 0, 2".
|
||||
attraction_acceleration = settings.get_pos3d("autopickup_attraction_acceleration", { x = 2, y = 0, z = 2 }),
|
||||
|
@ -67,12 +73,20 @@ autopickup = {
|
|||
--- Activates the system, if it has not been disabled by setting
|
||||
-- "autopickup_activate" to false in the configuration.
|
||||
function autopickup.activate()
|
||||
if settings.get_bool("autopickup_activate", true) then
|
||||
if autopickup.activate then
|
||||
autopickup.activate_internal()
|
||||
end
|
||||
end
|
||||
|
||||
function autopickup.activate_internal()
|
||||
if not autopickup.active then
|
||||
scheduler.schedule(
|
||||
"auto_pickup",
|
||||
"autopickup",
|
||||
autopickup.interval,
|
||||
autopickup.pickup_items_all,
|
||||
scheduler.OVERSHOOT_POLICY_RUN_ONCE)
|
||||
|
||||
autopickup.active = true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue