Commit Graph

34 Commits

Author SHA1 Message Date
Treer
43983d39d9 Use lua schematics instead of .mts files when building portals
Removes the need for the get_malleated_schematic_filename hack
2020-02-15 16:04:03 +11:00
Treer
b0f71302eb 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 16:04:03 +11:00
Treer
e2960e925b drop portal shape images to 2bit
Save some bits. Unfortunately PNG can't do 3bit-indexed images :(
2020-02-15 16:04:03 +11:00
Treer
0d9bf52748 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 16:04:02 +11:00
Treer
4d4a3435e2 Images instead of ASCII diagrams in Book of Portals 2020-02-15 16:04:02 +11:00
Treer
2f02ab3719 API exposes the registered portal count, and frame nodes 2020-02-15 16:04:02 +11:00
Treer
6b5b09b78d use minetest.get_modpath("mesecon") instead of checking mesecon ~= nil 2020-02-15 16:04:02 +11:00
Treer
fe17efea92 blasts extinguish portals 2020-02-15 16:04:01 +11:00
Treer
4297b312c9 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 16:04:01 +11:00
Treer
1312bf6dc5 Trim trailing spaces
This eliminates most luacheck formatting warnings
2020-02-15 16:04:01 +11:00
Treer
44e68d809d Update .luacheckrc and fix warnings
Changes to reduce formatting warnings will be committed separately
2020-02-15 16:04:00 +11:00
Treer
7b72364d15 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 16:04:00 +11:00
Treer
79ed3f17e1 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 16:04:00 +11:00
Treer
b74b92bb2d Add Minetest 0.4 support 2020-02-15 16:04:00 +11:00
Treer
55e4e9d78e 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 16:03:59 +11:00
Treer
2bddf340c5 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 16:03:59 +11:00
Treer
10d8925220 Move wormhole_node_is_horizontal into the shape definition
out of the portal defintion
2020-02-15 16:03:59 +11:00
Treer
7c11ee9017 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 16:03:58 +11:00
Treer
672069d798 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 16:03:58 +11:00
Treer
f9692faaa7 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 16:03:58 +11:00
Treer
ceb7148ce8 Check no other mod is already using a portal definition 2020-02-15 16:03:57 +11:00
Treer
c934cfa481 Add animated particle support
Also implements an ignition failure sound.
2020-02-15 16:03:56 +11:00
Treer
a679d2ca81 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 16:03:56 +11:00
Treer
97aa8da305 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 16:03:55 +11:00
Treer
84def1709c 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 16:03:55 +11:00
Treer
d2a18ad130 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 16:03:54 +11:00
Treer
fc90d79396 Implement sound and events in API 2020-02-15 16:03:54 +11:00
Treer
a4f78c654f 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 16:03:54 +11:00
Treer
d4d3af2cdf 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 16:03:54 +11:00
Treer
711c930697 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 16:03:54 +11:00
Treer
1f5cc9c94e only perform remote_portal_checkup if portal schematic was placed 2020-02-15 16:03:53 +11:00
Treer
44f4f5ed91 Portals connect to nearby targets
Records portal positions. More testing required
2020-02-15 16:03:53 +11:00
Treer
b04b4cb820 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 16:03:53 +11:00
Treer
5fe2c86866 provide Portal API 2020-02-15 16:03:52 +11:00