Commit Graph

46 Commits

Author SHA1 Message Date
Treer
52038017f3
Make ShiftExistingBiomes available via API (#40)
* bug fixes

Fixes wrong new_y_min when shift_existing_biomes() shifts a biome below the nether floor,
find_surface_anchorPos() no longer assumes y=0 will be outside the nether.
Nil-reference fixed when a mods tries to register a portal after mods are finished loading, but the portal shape+material was already registered by another mod.

* Make ShiftExistingBiomes available via API

makes the ShiftExistingBiomes function available to other mods via the nether global, since it's not a simple function and biomes would also need to be shifted if another mod wants to add a second nether layer.

* Allow layers to extend the depth of nether effects

Mods can set/lower nether.DEPTH_FLOOR_LAYERS when creating a layer under the nether. This allows multiple layer mods to know where their ceiling should start, and to be included in the effects which only happen in the nether.

* document nether API

More of a tentative interop guide than an API.
Use snake_case for API functions.
2021-07-18 16:44:37 +10:00
tenplus1
b90afa0b86 fix nil bug in portal_api.lua
fixes a nil bug in portal_api.lua where nodedef.is_ground_content isn't available.
2021-07-08 10:14:24 +10:00
sys4-fr
fb6b666895
Fix deprecation warnings (#44)
Co-authored-by: sys4 <bricassa@sys4.fr>
2021-04-18 16:30:05 +02:00
Louis
1268049706 Remove string.lower so item name is correctly translated 2020-09-28 00:07:03 +10:00
Treer
02d062b9c9 Handle large protected depths
Portals will now fail to ignite instead of defaulting to a fallback depth of (starty - 256) when no unprotected target can be found.
The search depth is also increased from (starty - 256) to (starty - 646)

This is to properly handle large protected areas that are sometimes set up at spawn - see issue #26
2020-08-02 12:19:30 +10:00
Treer
e326a94266
Add nether.debug() (#28) 2020-07-26 15:07:39 +10:00
Treer
5b3b56ebec
Respect protected areas when spawning remote portals (#27)
* respect protected areas when spawning remote portals

* Use portal_shape to determine area to check for natural/protected

* Log warning on deprecated function call
2020-07-26 14:34:06 +10:00
Treer
0e26770830
Merge pull request #18 from Treer/feature/portals-api-facedir-support
Add facedir support to Portals API
2020-06-01 22:08:15 +10:00
Treer
e5fbc2486b Allow a colorfacedir color to be specified for a portal's frame node
A color could also be specified via param2 in a portal schematic.
2020-05-31 19:48:26 +10:00
Treer
f7ebd78614 New/extra portal animation
(new animation by Extex101)
The original texture is now "nether_portal_alt.png", and used to provide a "nether:portal_alt" node, which is used/demoed by the Surface-portal as the original animation still has a "it's full of stars" charm coming out when used for lighter coloured portals.
2020-05-31 09:31:16 +02:00
Treer
e113db1478 Add facedir support to Portals API
Portal shematics include facedir information for when new portals are spawned using frame nodes that are facedir or colorfacedir
2020-03-04 00:31:33 +11:00
Treer
7939161535 API improvements
Improvements found while using the portals API in another mod (cloudlands):
* remote_portal_checkup() will check the whole portal and frame for mapgen overwrites.
* Allow find_realm_anchorPos() to return nil if no realm location could be found (portal will fail to ignite).
* Allow create_book_of_portals() to be invoked [indirectly] by other mods.

Also lowers nether_book_close.png to be 4bpp
2020-02-15 10:55:37 +01:00
Treer
32e5d818e8 Use lua schematics instead of .mts files when building portals
Removes the need for the get_malleated_schematic_filename hack
2020-02-15 10:55:37 +01:00
Treer
aa2bfe9472 prevent obscure portal behaviour bug
If a portal is being ignited and portal frame near-but-not-at its destination was found that was active and already linked back to the local portal, it would cause the local portal to be extinguished. (Required the remote portal to somehow be in a different state from the portal it was linking to)
2020-02-15 10:55:37 +01:00
Treer
4c3545f17a drop portal shape images to 2bit
Save some bits. Unfortunately PNG can't do 3bit-indexed images :(
2020-02-15 10:55:37 +01:00
Treer
39d655b4c8 Add Help-modpack support
https://forum.minetest.net/viewtopic.php?t=15912
Don't place Book of Portals in dungeon chests if its contents can be written in the help modpack Encyclopedia instead, and don't add Book of Portals to dungeon chests if Nether portals are the only type of portal - A Nether mod doesn't need a Book of Portals if it's only being used to provide a Nether portal.
2020-02-15 10:55:37 +01:00
Treer
36d1f6f573 Images instead of ASCII diagrams in Book of Portals 2020-02-15 10:55:37 +01:00
Treer
0618325710 API exposes the registered portal count, and frame nodes 2020-02-15 10:55:37 +01:00
Treer
8f29a35175 use minetest.get_modpath("mesecon") instead of checking mesecon ~= nil 2020-02-15 10:55:37 +01:00
Treer
e3ac1ade79 blasts extinguish portals 2020-02-15 10:55:37 +01:00
Treer
363872c760 Avoid storing the playerRef
See https://rubenwardy.com/minetest_modding_book/en/quality/common_mistakes.html#never-store-objectrefs-ie-players-or-entities
Related: https://github.com/minetest-mods/nether/pull/12
2020-02-15 10:55:37 +01:00
Treer
58da96549a Trim trailing spaces
This eliminates most luacheck formatting warnings
2020-02-15 10:55:37 +01:00
Treer
d0ce9dd633 Update .luacheckrc and fix warnings
Changes to reduce formatting warnings will be committed separately
2020-02-15 10:55:37 +01:00
Treer
1d19546345 Update copyrights & require Minetest v0.4.16 or greater
Also adds nether.register_wormhole_node(), moving the wormhole node template into portal_api.lua, and allowing wormhole nodes with custom post_effect_color to be more easily created.
2020-02-15 10:55:37 +01:00
Treer
3945467152 Add more mesecon support
wormholes now emit mesecon energy, allowing mesecons to know the state of the portal.
(mesecons could previously only set the state of the portal)
2020-02-15 10:55:37 +01:00
Treer
478684062d Add Minetest 0.4 support 2020-02-15 10:55:37 +01:00
Treer
4ebdf7f25f Handle edge-case when player quits the game while teleporting
Issue was raised as a pull request against the original code - https://github.com/minetest-mods/nether/pull/12
Also replaces deprecated getpos/setpos with get_pos/set_pos - https://github.com/minetest-mods/nether/pull/11
2020-02-15 10:55:37 +01:00
Treer
4985e199b1 check for portal frames on the surface
When a surface level was known, only the volume_is_natural check was being performed, this fixes that.
Also fixes bug where LBM didn't start the timer of example portals that had been disabled.
Allows portal ignite to repair a stopped timer.
Other misc cleanup - paramat's new Floatlands won't have lakes so I removed that from the flavortext.
2020-02-15 10:55:37 +01:00
Treer
48cbd87b59 Move wormhole_node_is_horizontal into the shape definition
out of the portal defintion
2020-02-15 10:55:37 +01:00
Treer
a971e0359e Finish example portals
give nether_portal_circular.mts a flat floor - the new nether_portal_circular.mts allows its bottom nodes to be sunk into the ground.
Example portal basic behavior and book_of_portals_pagetext implemented.
Other changes are allowing portals corrupted by ABMs to be repaired, finding better ground level of surface portals.
2020-02-15 10:55:37 +01:00
Treer
6752964c96 Add PortalShape_Platform
and other work on the portal examples
also documentation and fixing issue where apples prevented volume_is_natural() from returning true
2020-02-15 10:55:37 +01:00
Treer
11a818212a Standardize files as LF without CR, and UTF-8 without BOM
UTF-8 with BOM crashes some systems according to 6551f5c120 comment, and there are several cases where Minetest is buggy with files that use CRLF line endings (though none I'm aware that affect these files), so strip CRs and BOM
2020-02-15 10:55:37 +01:00
Treer
6e0cadb1ec Check no other mod is already using a portal definition 2020-02-15 10:55:37 +01:00
Treer
b8ec09f402 Add animated particle support
Also implements an ignition failure sound.
2020-02-15 10:55:37 +01:00
Treer
d5a551b4cf Add example alternative shape PortalShape_Circular
Also fixes up a few bugs that only became apparent when not using the traditional portal shape
2020-02-15 10:55:37 +01:00
Treer
31cf6a9bc3 Place_Schematic uses correct frame and wormhole nodes
This requires a cache-invalidation hack borrowed from cloudlands mod.
Also, null reference fixes in ensure_remote_portal_then_teleport and locate_or_build_portal, and minor improvements
2020-02-15 10:55:37 +01:00
Treer
dd6c19d005 Keep portal type in metadata for non-traditional portals
Makes the portal system more flexible - new portal shapes don't have to ensure there's a frame node at the timerPos
2020-02-15 10:55:37 +01:00
Treer
835ad9686d rearrange code
eliminate need to assign extinguish_portal() to a local var, and group the helper functions together in the API section
2020-02-15 10:55:37 +01:00
Treer
e2666146ca Implement sound and events in API 2020-02-15 10:55:37 +01:00
Treer
0c7a6e95c5 Fix edge case
Fix bug where ensure_remote_portal_then_teleport() converted its destination_wormholePos to an anchorPos to pass to locate_or_build_portal() which converted it back to an wormholePos. Bug occurred when local_orientation was assumed for the target orientation, which could lead to locate_or_build_portal() ending up with a reconstituted wormholePos rotated outside the portal frame, not find a portal frame, so build a new portal there, griefing the old one.

locate_or_build_portal() has been refactored to take a wormholePos instead of an anchorPos, removing the need to know the orientation of the target portal (which can't be obtained from the param2 when the target portal is unlit)
2020-02-15 10:55:37 +01:00
Treer
52b20925d5 Unlinks target portal if it's linked to a different portal
This is effectively a missing part to the change that made locate_or_build_portal() enforce that portals only link together in mutual pairs. As target portals that didn't need to be located or built we not being updated to link back to where the player travelled from.

Also
* implements events: on_run_wormhole, on_extinguish
* adds a lot of debug info
2020-02-15 10:55:37 +01:00
Treer
6401052f92 fix bugs
fixes nullreference in find_surface_target_y, and ensure_remote_portal_then_teleport assuming a traditional portal shape.
minor documentation work.
2020-02-15 10:55:37 +01:00
Treer
c106b88e98 only perform remote_portal_checkup if portal schematic was placed 2020-02-15 10:55:37 +01:00
Treer
1a6d15def3 Portals connect to nearby targets
Records portal positions. More testing required
2020-02-15 10:55:37 +01:00
Treer
43b37e96b2 Add Book of Portals
Squashed commit of the following:

commit e80030750df91f75745c7d52729a0d4942eb32f8
Author: Treer <treer.git+github@the-bordello.com>
Date:   Sat Jul 13 13:52:02 2019 +1000

    Finish book of portals

commit 82ad3d6af683b6bb4cc107e8c76f44c0b791a28d
Author: Treer <treer.git@gmail.com>
Date:   Thu Jul 11 22:43:02 2019 +1000

    Book of Portals art

commit fac6ff1da89a1b06b78deb0b5b4e3bebe4166860
Author: Treer <treer.git@gmail.com>
Date:   Thu Jul 11 00:39:50 2019 +1000

    starting book of portals
2020-02-15 10:55:37 +01:00
Treer
b6e2a3335a provide Portal API 2020-02-15 10:55:37 +01:00