9 Commits

Author SHA1 Message Date
Aaron Suen
4006f17aa8 Proof-of-concept dungeon loot.
- Identify candidate spots to place loot.
- Store loot placement spots for later handling.
  This will involve manipulating metadata and other
  things that are not necessarily safe to do while
  other mapgen_shared may run after us.
- Process the loot queue on tick.

Things left to do:
- Define loot tables and rarity values.
- Identify storeboxes and other storage mechanisms.
- Generate random stacks.
2020-06-28 21:06:00 -04:00
Aaron Suen
9879a23680 Mapgen determinism
This should cause maps that have the same
seeds to have much more similar results
than before, e.g. sponge deposits will be in
the same places determined by seed and not
random each regeneration of the map.

- Mapgen shared now provides an RNG which
  will be deterministic when feasible, for
  repeatable mapgen results.
- Make existing rng-using mapgen hooks use
  the new deterministic RNG.
- Mapgen shared hooks are also run in
  deterministic order too.
- Tidy up mapgen_shared API a little more.
2020-06-20 23:48:29 -04:00
Aaron Suen
e0156b4742 Add profiler instrumentation metadata everywhere
N.B. the MT built-in profiler doesn't yet actually support reading
labels from bare-function registrations, so a builtin hack is
needed.
2020-06-15 07:21:39 -04:00
Aaron Suen
361f69065d Make mapgen disable logic a bit more dynamic.
Mods may change singlenode mapgen to generate stone,
in which case we want them to be able to also reenable
the standard mapgen_shared hooks.

- If def.enabled == true, always run the hook.
- If def.enabled == false, never run it.
- If def.enabled is not set (nil) then run it based on
  standard logic, i.e. not on singlenode.
2020-01-12 11:01:30 -05:00
Aaron Suen
19de5dfd1e mapgen_shared improvements.
- Register def tables instead of bare funcs.
- Add labels for mod logic use.
- Automatically skip for singlenode mapgens,
  e.g. for the skyblock modpack.
2020-01-12 10:30:02 -05:00
Aaron Suen
fe2c153f9e Clean up all lua code style.
Formatting rules based on Paul Kulchenko's perl-based formatter...
http://notebook.kulchenko.com/programming/lua-beautifier-in-55-lines-of-perl
...using a single tab for indent.

Mostly pure whitespace changes.
2019-08-27 19:14:51 -04:00
Aaron Suen
db5cbd3de4 Avoid lighting bugs, players messing w/ inventory via CSM. 2019-04-09 21:06:55 -04:00
Aaron Suen
6e0d5a0778 Strata overhaul
- Apply stratification last in shared mapgens, so it can see all
  already-placed ores.
- Support stratification for nodes other than plain stone.
- Register lode stone and lode ore for stratification.
2019-02-24 10:19:22 -05:00
Aaron Suen
44b6a1d228 Shared mapgen API, add hard stone strata. 2019-02-23 22:48:39 -05:00