39 Commits

Author SHA1 Message Date
Aaron Suen
52a7211c00 Fix silk touch for lode ore 2021-08-07 15:20:05 -04:00
Aaron Suen
a6308d8378 Don't pre-initialize stone strata arrays
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.
2021-04-07 07:44:13 -04:00
Aaron Suen
f633e86235 Make raw ores not silk-touchable
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.
2021-03-15 00:11:05 -04:00
Aaron Suen
d4fdf8c6e8 Fix items unplaceable due to stack/touch-hurt 2020-09-26 15:03:22 -04:00
Aaron Suen
88c10d3d6e Mapgen optimization
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.
2020-06-28 20:24:15 -04:00
Aaron Suen
b1c6f6feb9 Make lodesign a little more visible 2020-06-09 07:20:00 -04:00
Aaron Suen
c9b432d5e5 Lodesign redesign
Should be subtler at a distance, but more distinct up close.
2020-06-09 07:09:58 -04:00
Aaron Suen
23527e264b Artificial stone hardening process
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.
2020-06-04 08:09:30 -04:00
Aaron Suen
1b646d3f63 Try to enforce stone group sanity 2020-06-04 07:33:49 -04:00
Aaron Suen
14f4c505e5 Fix lode-sign stone being silktouchable
This should be consistent with plain terrain stone now.
2020-05-31 08:51:38 -04:00
Aaron Suen
920fba34ee Separate node stand/touch/radiant damage types
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.
2020-04-09 06:56:18 -04:00
Aaron Suen
c6cabca0e9 Stone bricks by WintersKnight94
- 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.
2020-03-29 20:55:55 -04:00
Aaron Suen
1c612ee1f7 Cobbley group, generic scaling factors by group 2020-03-29 08:05:13 -04:00
Aaron Suen
f37a918f0f Scaling and touch-hurt reforms
- 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)
2020-03-29 07:55:54 -04:00
Aaron Suen
bcbe77644e Buff drowning damage, nerf some node damage. 2020-02-19 19:55:22 -05:00
Aaron Suen
6a89bb5415 Compromise grass, and some more lode textures. 2020-02-18 19:02:52 -05:00
Aaron Suen
9642564378 Lode ore updates. 2020-02-18 00:29:40 -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
6e1f3fee94 Standardize intra-line spacing in code. 2019-12-01 11:08:12 -05:00
Aaron Suen
e4dba54be3 Lode smelting rework.
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.
2019-10-06 10:31:58 -04:00
Aaron Suen
e48d306e98 Fix broken lux ore hard strata. 2019-09-15 07:32:06 -04:00
Aaron Suen
39dea8a2ae MAJOR: Code quality audit using luacheck.
- Removed lots of unused variables, a few shadowed identifiers.
- Removed a few sections of dead code.
2019-08-31 09:26:53 -04: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
431594b1b6 More nuanced ore distribution.
- 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.
2019-04-04 08:48:55 -04:00
Aaron Suen
3614068263 Bug fixes, tidier craft excess handling. 2019-04-03 08:10:03 -04:00
Aaron Suen
4b1488ed3f Hints system overhaul.
- 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.
2019-04-03 07:41:27 -04:00
Aaron Suen
05efab5c58 Lode ore distribution overhaul.
- 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.
2019-03-31 12:59:09 -04:00
Aaron Suen
a8766c8b42 Fix deep lode ore description. 2019-03-29 21:46:54 -04:00
Aaron Suen
584fd2f9fa Make deep stone dig through each stage, taking longer to dig. 2019-03-24 23:15:34 -04:00
Aaron Suen
209e0491a4 Fix loose lode cobble sounds 2019-03-16 17:02:10 -04:00
Aaron Suen
5de0cc54ec Add stony sounds, and sounds for stacks/shelves. 2019-03-14 00:31:09 -04:00
Aaron Suen
0603683626 Typo. 2019-03-06 21:54:52 -05:00
Aaron Suen
611733d7d8 Naming refinements. 2019-03-06 21:52:53 -05: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
Aaron Suen
b622883995 Made living sponges spread. 2019-02-19 19:02:21 -05:00
Aaron Suen
1a3afc6fa9 Cleanup. 2019-02-09 23:24:01 -05:00
Aaron Suen
4a69f64b7d Remove excess doc, fix lode cobble hand-diggability. 2019-01-29 23:07:00 -05:00
Aaron Suen
a0602d52b4 Start defining metal materials. 2019-01-27 09:19:07 -05:00