diff options
author | paramat <mat.gregory@virginmedia.com> | 2015-10-13 05:17:33 +0100 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2015-10-18 16:42:59 +0100 |
commit | 3b9f99e0d61957c571ba857301d58ad29fb44527 (patch) | |
tree | e42aca267416df268d0e971b73c1db4a7e6358fe /src/environment.cpp | |
parent | 2364449d7a173086c2681eae267b32e5c1596b00 (diff) | |
download | hax-minetest-server-3b9f99e0d61957c571ba857301d58ad29fb44527.tar.gz hax-minetest-server-3b9f99e0d61957c571ba857301d58ad29fb44527.zip |
ABMs: Make catch-up behaviour optional
Default is true for backwards compatibility
Update lua_api.txt
Diffstat (limited to 'src/environment.cpp')
-rw-r--r-- | src/environment.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/environment.cpp b/src/environment.cpp index 88f25536f..0b37212e5 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -577,17 +577,21 @@ public: i->timer -= trigger_interval; actual_interval = trigger_interval; } - float intervals = actual_interval / trigger_interval; - if(intervals == 0) - continue; float chance = abm->getTriggerChance(); if(chance == 0) chance = 1; ActiveABM aabm; aabm.abm = abm; - aabm.chance = chance / intervals; - if(aabm.chance == 0) - aabm.chance = 1; + if(abm->getSimpleCatchUp()) { + float intervals = actual_interval / trigger_interval; + if(intervals == 0) + continue; + aabm.chance = chance / intervals; + if(aabm.chance == 0) + aabm.chance = 1; + } else { + aabm.chance = chance; + } // Trigger neighbors std::set<std::string> required_neighbors_s = abm->getRequiredNeighbors(); |