Commit Graph

91 Commits

Author SHA1 Message Date
David Leal 95845dfb08
Use organization's LuaCheck workflow 2024-02-13 14:30:15 -06:00
Niklp 3d217950b3 fix incorrect mod URLs 2022-07-09 13:23:23 +03:00
sys4-fr 20c89d0ee6
Delete description.txt, update mod.conf (#9)
Co-authored-by: sys4 <bricassa@sys4.fr>
2022-07-06 20:05:17 +02:00
Luke aka SwissalpS 396ca881df
typo in debug output 2022-01-20 06:34:51 +01:00
Jordan Leppert 932485a6fe
register_on_generate: tries and rarity_fertility (#8)
* Can specify the number of tries when generating
* Added rarity_fertility which means rarity can be affected by fertility level.
Rarity can now be a fraction.
A rarity of 100 (with rarity_fertility of 0) means the object will never appear, and a rarity of 0 means it will always appear.
2021-12-24 09:30:36 +01:00
Jordan Leppert bd92dc1b0b
Fixing humidity/temperature data (#5)
* Fixing humidity/temperature data returned from get_biome_data() to fix the range (and sign) of the original data
* Removing unused variables
Co-authored-by: OgelGames <olliverdc28@gmail.com>
2021-12-11 19:45:04 +01:00
Buckaroo Banzai a3ce221eed
Add luacheck and github workflow (#4)
Co-authored-by: BuckarooBanzay <BuckarooBanzay@users.noreply.github.com>
Co-authored-by: OgelGames <olliverdc28@gmail.com>
2021-12-10 13:45:31 +11:00
nixnoxus 3a1446e26e
Remove unused `intllib` translations (#6) 2021-12-10 13:16:36 +11:00
Jordan Leppert 823db77217
Enable generating objects on sides or bottom of nodes at mapgen time (#2)
* biome_lib.register_on_generate now supports spawn_on_sides and spawn_on_bottom flags
* biome_lib.register_on_generate now passes node position and face direction to node placement function
* Replacing spaces with tabs
* Fixing API to ensure it behaves same way it used to, when not passing spawn_on_sides or spawn_on_bottom flags.
2021-12-06 19:22:29 +01:00
sfan5 4e3493a981 use %Y-%m-%d for the date instead of %F
strftime codes don't work in some Windows + LuaJIT setups, see:
https://sourceforge.net/p/mingw-w64/bugs/793/
fc63c938b5
2021-04-23 18:45:40 -04:00
Vanessa Dannenberg e8afe017da Use engine decorations when possible 2021-04-23 17:03:29 -04:00
Vanessa Dannenberg 76b5046009 Split the actual API code into a separate file from init.lua 2021-04-20 21:05:50 -04:00
Vanessa Dannenberg 5148cca1b7 Using ":" notation to treat functions as methods is now deprecated
in favor of more normal "." notation.

In the process, I have renamed a few functions in favor of
more meaningful names (see API.txt), and provided
"compatibility shims" for old mods where needed, with warnings.
2021-04-20 17:40:03 -04:00
Vanessa Dannenberg c4151a0701 add timestamps to log output 2021-04-20 13:46:21 -04:00
Vanessa Dannenberg bf2ac2ea57 don't nil-out the recheck list, just empty it. 2021-04-16 13:06:24 -04:00
Vanessa Dannenberg 6342a16b0a Reign-in the default on-generated limit from +/- 31k to -16/+48m
since nothing much is normally found outside that range anyway

only enqueue blocks that are within that range, or within
the range specfied by all of the mods that make generate_plant() calls,
whichever covers more volume.
2021-04-16 13:02:54 -04:00
Vanessa Dannenberg c6cd524f62 fix reporting of log sizes during shutdown 2021-04-16 12:06:52 -04:00
Vanessa Dannenberg 2dbacae561 remove mapblocks from the queue early if they have no surfaces to work on
(sadly can't be done for blocks in the deferred queue until
they come out of "idle")
2021-04-16 12:02:13 -04:00
Vanessa Dannenberg f165434a84 change the queue ratio config setting
to avoid breaking old configs
also increase the default amount of work done per tick.
2021-04-16 10:41:38 -04:00
Vanessa Dannenberg d6cba18844 add a mention in the readme about the mod's config settings 2021-04-16 10:39:17 -04:00
Vanessa Dannenberg f003f19998 add a proper settingtypes.txt 2021-04-10 06:01:01 -04:00
Vanessa Dannenberg d06ab90e01 allow re-check-log entries to time out gradually rather than
having to go all at once.  This purges the log sooner than before,
but without damaging the mapgen results.
2021-04-09 13:26:42 -04:00
Vanessa Dannenberg ba46e6c05e Report the mod's progress and ETA
while purging the mapblock log at shutdown
2021-04-09 12:38:09 -04:00
Vanessa Dannenberg ed0b23677d fix typo 2021-04-08 08:09:59 -04:00
Vanessa Dannenberg 3b35fc67c6 Periodically re-trigger the mapblock queue code if it's idle,
to give old, deferrred blocks a chance to time-out.  Needed
because if players aren't currently creating new terrain,
old blocks would never get processed, causing the block log
to only grow rather than eventually run dry (which could result
in very long shutdown times).
2021-04-08 06:33:43 -04:00
Vanessa Dannenberg eabc053c05 If a block has to be re-checked, renew its timestamp 2021-04-07 09:12:57 -04:00
Vanessa Dannenberg dd650da443 Allow old blocks to time-out after a while
(default 5 minutes).

Rationale: if a block is old enough, there's a very high probability
that the engine's done screwing around with its neighbors, so it's safe
to process.
2021-04-07 07:41:48 -04:00
Vanessa Dannenberg 0a34e3c7af rename debug variable and option for consistency
make global so it can be changed while running
2021-04-07 07:41:32 -04:00
Vanessa Dannenberg 07c2b1d9d4 move all settings at the top of the code
(some were scattered here and there)
2021-04-07 07:13:53 -04:00
Vanessa Dannenberg 1dc0febd8c print a message when the queue goes idle. 2021-04-07 05:26:31 -04:00
Vanessa Dannenberg 50f921a85a implement variable log levels
so that one need not see all the spammy stuff
if the only things of interest are e.g. warnings
2021-04-07 05:16:11 -04:00
Vanessa Dannenberg 6009f261c2 make sure that any block about to be scanned is definitely loaded (in
case the engine has unloaded the block because the player wandered off
for too long)
2021-04-07 04:55:57 -04:00
Vanessa Dannenberg 531577afcf rather than copy the re-check log back into the block log when it comes
time to run through it, just use it in-place, copying its entries back
to the main block log if they have to be skipped again (essentially
using the re-check list and the end of the block log as a double buffer)
2021-04-07 01:44:31 -04:00
Vanessa Dannenberg e346fd599f rather than rearranging the block log to deal with blocks that can't be
populated yet, move those blocks to a separate list, and replay that
list whenever new mapblocks come in.  That way the main block list can
run dry and allow the block populate routines to go idle.

Thanks to Warr1024 for the idea!
2021-04-06 16:09:50 -04:00
Vanessa Dannenberg 212024a9b4 tiny optimization 2021-04-06 13:38:43 -04:00
Vanessa Dannenberg 1d2593f022 if the block list is empty, don't try to start another batch of actions. 2021-04-06 13:08:43 -04:00
Vanessa Dannenberg 3bc8737e2d make sure the target mapblock and all 8 of its corner neighbors have
been generated before populating the block (else move the target block
the end of the queue)

Thanks to Warr1024 for this idea!
2021-04-06 12:47:05 -04:00
Vanessa Dannenberg 0ea4cb3848 don't bother checking dtime during globalstep
it's enough to rely in the run ratio.
2021-04-06 10:00:16 -04:00
Vanessa Dannenberg bef0a0d87e oops, forgot to allow for no-air-check blocks 2021-04-06 04:19:57 -04:00
Vanessa Dannenberg 89ca62e492 added a bunch of debugging info 2021-04-06 03:20:14 -04:00
Vanessa Dannenberg a325c2ccd8 rewrote block queue handlers to reduce code duplication
and improve lag management

minetest.conf settings added:

biome_lib_dtime_limit:

Maximum lag allowed, in seconds.  Default 0.5s.  Larger values allow for
more lag, but make map updates run a bit faster.

biome_lib_queue_run_ratio:

If positive, this is the approximate number of globalstep ticks to skip
between map updates. If negative, it becomes the positive number of map
updates to run per globalstep tick before lag is checked.  No minimum
value, maximum +100.  Default: -100 (that is, 100 updates per globalstep
tick, with none intentionally skipped).  Use positive numbers for slow
machines or biome_lib-using mods that tend to cause lag, and negative
values for fast machines and mods.
2021-04-06 03:20:12 -04:00
Vanessa Dannenberg 8ecb401309 fix a couple of missing = signs 2021-04-05 12:44:21 -04:00
Vanessa Dannenberg 9ed4858518 take the integer of that last division I added
always round up.  otherwise it'll break the `for` loop
if a mod supplies a value not divisible by 25 :-)
2021-04-01 09:02:41 -04:00
Vanessa Dannenberg 26dbbb5a67 since we split to mapblocks now,
biome.max_count as received from mods has to be scaled appropriately
as mods expect this value to be relative to the usual
chunk size of 80x80 = 6400 nodes' horizontal area.
2021-04-01 08:32:45 -04:00
Vanessa Dannenberg ec0a0f0c3b add some debugging messages 2021-04-01 07:18:28 -04:00
Vanessa Dannenberg e92361675f remove the old-plantslib-api compat thing 2021-04-01 06:24:09 -04:00
Vanessa Dannenberg 7f1fec6ae0 add compatibility for games other than minetest_game 2021-04-01 05:47:22 -04:00
Vanessa Dannenberg f569bb1fbd fix outdated "plantlife" message
and some redundancy
2021-04-01 05:03:29 -04:00
Vanessa Dannenberg f2a807b814 make debug mode a proper minetest.conf setting 2021-04-01 05:02:07 -04:00
Vanessa Dannenberg 9b7705c380 move the "registered N actions on M surfaces" message to debug 2021-04-01 04:59:57 -04:00