Commit Graph

58 Commits

Author SHA1 Message Date
Vanessa Ezekowitz
591a917e21 performance improvement
cache type() check of node/function/model, always check if it's string
before trying to execute that string as a function.
2014-05-24 16:39:35 -04:00
SoniEx2
942aefd7dd Better handling of function calls
Make sure that bad function calls fail safely, and failed function
calls don't leave spawned=true
2014-05-24 16:26:59 -04:00
Vanessa Ezekowitz
c1d3d6b454 couple small optimizations in mapgen code 2014-05-16 17:04:12 -04:00
Vanessa Ezekowitz
6b65eeb1fb better way to test for valid function name in generate call, by SoniEx2 2014-05-16 16:39:32 -04:00
Vanessa Ezekowitz
5eb48a2c67 got rid of more debugging stuff 2014-05-15 06:26:18 -04:00
Vanessa Ezekowitz
2e0293a3f3 got rid of all extraneous debugging statements
left the actual function in, and replaced one call with a print statement
since if it happens, it indicates a non-fatal error that should always be
reported anyway (invalid object refs in mapgen calls)
2014-05-15 06:23:50 -04:00
Vanessa Ezekowitz
df6f23baed last revision date 2014-05-15 06:09:59 -04:00
Vanessa Ezekowitz
087c661090 more robust handling of function/table/string values
in register_generate_plant() call (to handle e.g. unknown nodes being spawned)
2014-05-15 06:08:25 -04:00
Xanthin
2cb4435a85 little translation update
I fear the dbg
2014-03-20 01:57:17 +01:00
Vanessa Ezekowitz
e7d6a2e993 local-ize a couple of variables 2013-12-15 13:41:07 -05:00
Vanessa Ezekowitz
f168f0acb2 Take time_speed into account
when setting spawning and growing ABM intervals.

also, add some basic sanity checks to the interval value just in case
the math comes out wrong.  Rearranged a bit of code to accommodate these
changes.
2013-11-15 20:48:28 -05:00
Vanessa Ezekowitz
94e21c0cf6 multiple changes
Make bushes use default farming mod's flour for making pies instead of
jungle grass, if that mod is installed.  Junglegrass will be used if farming
is not present.

Make bushes mod support farming_plus more completely - either its or
bushes' strawberries may be used to make a strawberry pie or a mixed
fruit pie - mix and match the two types of strawberries as desired.

move clone node function from junglegrass mod to plants_lib so that
other mods can use it.
2013-11-02 19:52:08 -04:00
Vanessa Ezekowitz
2d619ab154 add missing S() function def for intllib 2013-10-26 17:29:50 -04:00
Vanessa Ezekowitz
c34828ef9d slight clean up in the lines that check for node density 2013-09-14 22:44:16 -04:00
Vanessa Ezekowitz
a401f1369d Make waterliles placable on the surface of standing water.
Lilies will be rotated randomly on place, in the same manner as they're
usually generated.

Hold 'sneak' (usually shift) while placing to force them to follow your
facedir instead.

Liles will replace buildable_to nodes when placed, including themselves.
This will cause a loss of lilies if you just keep placing them over and
over, but this is intentional.

node_ownership, glomie's protection mod, and zeg9's protection mod are
accounted for, as are infinite item stacks (e.g. plain creative mode).

Also, compact the waterlily register node calls into a loop.
2013-08-19 02:16:00 -04:00
Vanessa Ezekowitz
448e3d2be2 Phased out all deprecated minetest.env:* uses in favor of minetest.* 2013-06-30 23:55:07 -04:00
PilzAdam
bd1300409d Dont use dump() hack 2013-06-16 10:42:29 -04:00
Vanessa Ezekowitz
13114913f5 forgot to include benchmark for external function call
also default debug to false again
2013-03-31 01:07:45 -04:00
Vanessa Ezekowitz
3b3425c1e6 made the benchmark output report times in ms instead of seconds. 2013-03-31 00:55:39 -04:00
Vanessa Ezekowitz
2102cf269a added rudimentary benchmarking output to chunk processing and tree gen calls 2013-03-30 23:30:33 -04:00
Vanessa
aefb98c60e Fixed waterlilies to use proper facedir range ("6d facedir" code fixes an
oversight in the engine that in turn revealed a bug in my code)
2013-03-24 03:36:13 -04:00
Vanessa Ezekowitz
aaee2d50cc fixed a minor bug:
plants_lib/init.lua:83: bad argument #1 to 'getn' (table expected, got nil)
2013-03-10 00:38:20 -05:00
Vanessa Ezekowitz
340ac5e0bf move rest of biome defaults into set_defaults() function 2013-03-09 17:06:21 -05:00
Vanessa Ezekowitz
8767ebb1f3 various internal code improvements
better way to set default biome params, optimized-out some copypasta, thanks
to thexyz for spotting these.
2013-03-09 16:47:58 -05:00
Vanessa Ezekowitz
5c2860ed53 p_top should be pos at lines 376, 377 2013-02-24 12:13:09 -05:00
Vanessa Ezekowitz
e88c54213f copy&paste bugfix, biome.seed_diff at line 375 should be just seeddiff. 2013-02-24 01:55:03 -05:00
Vanessa Ezekowitz
199fa00b0b Added a couple features to the API to allow for turning off checking for air,
deleting nodes surrounding the spawn target during the mapgen code, replacing
the spawn target, and checking the type of node directly below the spawn
target.
2013-02-23 12:33:46 -05:00
Vanessa Ezekowitz
96df170e2d Made a couple of perlin functions global so they aren't being redefined
every time an ABM or on_generated is called.  Optimized a number of nil
comparisons ("if x == nil" -> "if not x" and similar).
2013-02-23 00:34:03 -05:00
Vanessa Ezekowitz
6bfb454178 routed spawn_tree() through a wrapper function so that other mods can hook into
plants_lib's calls to do something extra when a tree is generated at mapgen
time or spawned via the growing code.
2013-02-19 21:50:56 -05:00
Vanessa Ezekowitz
a86c52cfa8 changed perlin settings for humidity layer to match deserts
Thanks to paramat for spotting this!
2013-02-03 03:01:44 -05:00
Vanessa Ezekowitz
8df8e44a0c add experimental support for calling an arbitrary function
in the spawning ABM after all other biome tests and general checks (aside from
spawning at the sides/bottom/top of a node) are done.
2013-01-29 16:22:33 -05:00
Vanessa Ezekowitz
8015cc24a5 Added experimental settings to allow for a humidity perlin layer
and to allow the spawned object to *replace* the node it would otherwise
spawn on top of.

Also, extended API to allow for a node to be directly named in the
register_generate_plant() call.
2013-01-29 00:13:03 -05:00
Vanessa Ezekowitz
18ef2a32e4 Forgot to add the bit of code needed to make the facedir parameter
in the spawn_on_surfaces call actually work.  Fixed.
2013-01-27 15:06:11 -05:00
Vanessa Ezekowitz
68a6ce43a7 Changed plants_lib API to require a table argument when not using legacy
calling options.  This opens the door for even more features in the future.
Changed flowers, junglegrass, poisonivy to match.

Made plants lib faster in some places, especially the surface-hunting
algorithm, and especially over water.  Fixed a few other misc. bugs.

Made growth code properly execute all biome-control code before executing
any string-named function or spawn_tree().

Tuned flowers settings.  Made flowers require at least some light to spawn,
made waterlilies require shallower water.  Fixed a bug in water depth detection
and made water depth depend on whether the bottom of the water area is dirt,
dirt with grass, or sand, rather than just anything.

Made waterlilies randomly rotate on spawning to break up the patterns (now has
16 orientations with the help of nodeboxes and facedir, requires only 3 new
nodes). Smoothed edges of the regular waterlily texture.  Made all flowers and
water- lilies spawn using only 3 ABM calls instead of 8.

Got rid of colon prefix node def overrides on all plants, since this is a
modpack now instead of an integrated mod.  Fixed a misspelled folder name for
poisonivy.

Fixed a bug in the wall detection routine - it returned the last wall found,
not the first.

Made the top-side-check for air only apply when spawning on top of the
target rather than its sides/bottom.

Many other features and enhancements have been made.  Too many to list here.
Please see API.txt for details.
2013-01-25 23:16:54 -05:00
Vanessa Ezekowitz
3024c78c2b fixed a bug where plants_lib depended on poisonivy for a table it needed.
thanks to bas080 for spotting that one.
2013-01-24 02:29:23 -05:00
Vanessa Ezekowitz
a8491ae232 added some code to further trim the number of nodes that have to be checked.
This causes trees to be just a tad more sparse than intended, but greatly
speeds up the map generator.

Worst case drops from thousands of nodes to test per tree type to a 5-15 nodes
per tree type.
2013-01-21 23:41:02 -05:00
Vanessa Ezekowitz
07f426ae45 disable debug by default 2013-01-20 14:53:22 -05:00
Vanessa Ezekowitz
592d0df84f fixed bugs in use of debugging function from having class-ified it. 2013-01-20 14:44:21 -05:00
Vanessa Ezekowitz
e327630ea5 Fixed a minor bug, made growing abm always check for grow_nodes
under the plant to be grown and to check for air above it.
2013-01-20 14:16:05 -05:00
Vanessa Ezekowitz
693f59a3fc moved some forgotten print statements into debugging facility 2013-01-20 13:56:13 -05:00
Vanessa Ezekowitz
147aee56db move debugging into a separate function, disable by default 2013-01-20 13:51:09 -05:00
Vanessa Ezekowitz
34b7ad4f32 Fixed a bug in direct growing of trees 2013-01-20 13:37:58 -05:00
Vanessa Ezekowitz
40b4cc677a forgot to set default value for rarity control, 50. 2013-01-20 12:02:59 -05:00
Vanessa Ezekowitz
5abcd9034e Added random-number-based rarity control 2013-01-20 12:01:07 -05:00
Vanessa Ezekowitz
b41cf5570c updated the date in init.lua 2013-01-20 01:38:43 -05:00
Vanessa Ezekowitz
b434ff4370 Added option to allow plants_lib to directly spawn a tree if passed a table
instead of a function name in the appropriate field.
2013-01-19 23:21:33 -05:00
Vanessa Ezekowitz
1229b10014 sped up mapgen functions massively. I think it's suitable
for general use now!
2013-01-19 14:24:15 -05:00
Vanessa Ezekowitz
0580a2f416 just a minor logic tweak to try to speed the mapgen code up further. 2013-01-19 13:12:07 -05:00
Vanessa Ezekowitz
a83979e342 sped up the biome evaluation code somewhat, but it's still slow. 2013-01-19 02:10:26 -05:00
Vanessa Ezekowitz
7dd3ec2525 Added a function to let one spawn plants at mapgen time,
but it's slow as molasses in January.  Not recommended for
general use yet.
2013-01-19 00:45:46 -05:00