The original theory was that preallocating the array forced lua
to use the "array part" of a table instead of the "hash part",
which should be faster since lookups are a simple linear offset
calculation and not a hash with collision check.
It turns out, however, that in empirical testing, whether the
array-preallocated or the naive-allocated version is faster depends
on circumstances, such as how sparse the array is, how uniform
access is, or how much other load the system is under. This seems
to suggest that arrays are more computationally-efficient but less
cache-efficient, so cache evictions caused by other concurrent
processes may slow this method down significantly.
Worst-case performance will be the most noticeable here, since a
system that's heavily loaded would have the most need for speed
in the first place, so it's probably better generally to use the
naive allocation.
In all, the naive allocation method also seemed to be the least
sensitive to external factors. In addition to the array method,
attempts to pre-compile the dynamic checks into a binary tree of
if/then statements (which could be JITted and optimized) failed
as well.
For one thing, it's a bit overpowered when you go
right from infused still digging lode ore as loose
cobble, right to boosted-infused digging it as raw
ore.
For another, uncobbled lux stone is purposefully
labeled as just plain stone to force the player to
pay attention to light cues, but this would make
inventory management problematic once smooth
lux stone has been collected with boosted tools.
Two optimizations that added up to a significant
time savings in on_generated:
- Replacing calls to area:index(x,y,z) to precalculating
an offset and then using stride math inside the loops
gives us a huge cost savings.
- Prefilling lookup-by-ID tables to force them into
sequential arrays instead of hashmaps speeds up
lookups, for a more moderate savings.
Stone is hardened by creating an elecric field via the Peltier
effect that causes internal crystals to align. Or something like
that.
Stone hardens over time when touching both lava and water.
All stratafiable stone types (lode sign, lode ore, lux ore) are
affected.
Don't reuse damage_per_second for damage on punch and radiant
damage. This allows these to be defined separately, i.e. no longer
assuming that all damage is from "heat" and can radiate. This
allows for things like thorny plants that hurt if you touch them
or stand in them but not if you stand near them.
Thanks to WintersKnight94 for reporting this.
- Original texture by WintersKnight94.
- Node definitions and recipes adapted from original.
- Added some hooks in a few other places to make new
recipes work.
- Chip smooth stone with a lode pick or better to make brick.
- Bricks fall but don't repose.
- Apply mortar (wet aggregate) to bond stone bricks
- Bonded bricks can be moved but don't fall anymore.
- Storeboxes are now scalable.
- Standardize touch-hurt operation.
- Touch-hurt damage on scaling.
- Now possible to alter scaling time via scaling_time
group (percent of original scaling time)
- Register def tables instead of bare funcs.
- Add labels for mod logic use.
- Automatically skip for singlenode mapgens,
e.g. for the skyblock modpack.
Separate ore melting and draining processes, to
ease the cognitive leap necessary to figure out
lode smelting. Players now get feedback when
they have figured out the heating part of the
process, and the visual for cobble with molten
lode in it hints at the draining process.
- There is now a thin "background" amount of lode at all depths,
so you should never dig too large a stata without finding
anything at all.
- Ore is now not only more plentiful at depth, but also packed
into denser clusters, so you have to mine for longer before
finding a huge deposit.
- Included new content.
- Partially converted to base on recipes instead of just items.
- Added support for group and toolcap checks.
Fixed a number of small bugs elsewhere in the process.
- Don't generate in high terrain above y = 32 at all.
- Increase concentraion through 7 different strata moving downwards
up until max concentration at y = -4096. This creates incentives
for digging deep instead of just staying at surface.
- 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.