Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portal abstraction #8

Merged
merged 55 commits into from
Feb 15, 2020
Merged

Commits on Feb 15, 2020

  1. Separate portal shape code from portal behavior code, and refactor

    Allows dev and testing/debugging to focus on one (shape or behavior) without getting mixed up in the other, will also enable different portal shapes later on. Other adjustments:
    * Reuse/reignite an existing portal or portal frame if there is one at the remote destination, rather than the area being overwritten by a slightly offset portal schematic.
    * Create remote portals in a matching orientation to the local portal.
    * Preserve player position & facing relative to portal when traveling through wormhole (even if portals are at 90°)
    * Players no longer bounce several times after teleporting
    * Player is not teleported until after the portal at the other end is confirmed/built
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    d9911e6 View commit details
    Browse the repository at this point in the history
  2. Add mesecons support

    Portals can be switched on and off with mesecons
    (from a tech-tree perspective, mese is still required for portal ignition)
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    a9cdc36 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    df4b40f View commit details
    Browse the repository at this point in the history
  4. Allow reignition of portals in player-built areas

    e.g. allow remote ignition to a portal in a "portal room"
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    dd761b4 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    1a222d4 View commit details
    Browse the repository at this point in the history
  6. tidy up some code

    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    74b25ac View commit details
    Browse the repository at this point in the history
  7. Fix call to node timer stop()

    Part of e5a5db9, fixes an issue where node timers weren't stopped by extinguish_portal().
    And tweaks some comments
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    71244a7 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    e221cf1 View commit details
    Browse the repository at this point in the history
  9. Prevent portals from sharing frame nodes with other portals

    While it's rather cute having portals that share parts of their frame with other portals, the way the nether mod implemented portals means a node being part of more than one portal enables a family of bugs.
    
    Igniting a portal now extinguishes any portal that was using nodes now taken by the newly ignited portal.
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    d45908e View commit details
    Browse the repository at this point in the history
  10. Allow two or more portal types to be made with the same frame material

    (provided they are different sized portals)
    Removes direct references to the registered_portals table
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    b3d1339 View commit details
    Browse the repository at this point in the history
  11. Dynamic/hardware portal colouring

    Currently proof of concept: Removes wormhole colour from .png texture and specifies it through MT API instead. The post_effect_color may call for registering a separate node per portal colour.
    Palette 0 will have to be the traditional portal magenta (instead of 0 being black) for map compatibility with mod when colour was in the texture and not param2.
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    67bf24e View commit details
    Browse the repository at this point in the history
  12. provide Portal API

    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    5fe2c86 View commit details
    Browse the repository at this point in the history
  13. 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
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    b04b4cb View commit details
    Browse the repository at this point in the history
  14. Portals connect to nearby targets

    Records portal positions. More testing required
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    44f4f5e View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    1f5cc9c View commit details
    Browse the repository at this point in the history
  16. fix bugs

    fixes nullreference in find_surface_target_y, and ensure_remote_portal_then_teleport assuming a traditional portal shape.
    minor documentation work.
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    711c930 View commit details
    Browse the repository at this point in the history
  17. 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
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    d4d3af2 View commit details
    Browse the repository at this point in the history
  18. 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)
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    a4f78c6 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    fc90d79 View commit details
    Browse the repository at this point in the history
  20. rearrange code

    eliminate need to assign extinguish_portal() to a local var, and group the helper functions together in the API section
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    d2a18ad View commit details
    Browse the repository at this point in the history
  21. 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
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    84def17 View commit details
    Browse the repository at this point in the history
  22. Unroll 32affba (stairs) (minetest-mods#9)

    32affba re-registered stairs which have already been registered 20 lines earlier in the code, and registered them as "brick" causing the netherbrick stairs to replace Minetest's default:brick stairs. The rest of 32affba was already unrolled in 7a0e52d, but the stairs bug remained.
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    21e312f View commit details
    Browse the repository at this point in the history
  23. Add portal ignition sparks

    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    e82d9e3 View commit details
    Browse the repository at this point in the history
  24. 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
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    97aa8da View commit details
    Browse the repository at this point in the history
  25. Add example alternative shape PortalShape_Circular

    Also fixes up a few bugs that only became apparent when not using the traditional portal shape
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    a679d2c View commit details
    Browse the repository at this point in the history
  26. Add portal sounds

    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    98ca59b View commit details
    Browse the repository at this point in the history
  27. Add animated particle support

    Also implements an ignition failure sound.
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    c934cfa View commit details
    Browse the repository at this point in the history
  28. Add portal_examples.lua

    Currently the example portals just take you to the nether, like nether portals. In theory they could take players anywhere.
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    d5bfb14 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    ceb7148 View commit details
    Browse the repository at this point in the history
  30. documentation

    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    f11669f View commit details
    Browse the repository at this point in the history
  31. Standardize files as LF without CR, and UTF-8 without BOM

    UTF-8 with BOM crashes some systems according to 6551f5c 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
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    f9692fa View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    c15fd36 View commit details
    Browse the repository at this point in the history
  33. Add PortalShape_Platform

    and other work on the portal examples
    also documentation and fixing issue where apples prevented volume_is_natural() from returning true
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    672069d View commit details
    Browse the repository at this point in the history
  34. 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.
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    7c11ee9 View commit details
    Browse the repository at this point in the history
  35. Add settingtypes.txt settings

    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    1ddf1be View commit details
    Browse the repository at this point in the history
  36. Move wormhole_node_is_horizontal into the shape definition

    out of the portal defintion
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    10d8925 View commit details
    Browse the repository at this point in the history
  37. 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.
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    2bddf34 View commit details
    Browse the repository at this point in the history
  38. Handle edge-case when player quits the game while teleporting

    Issue was raised as a pull request against the original code - minetest-mods#12
    Also replaces deprecated getpos/setpos with get_pos/set_pos - minetest-mods#11
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    55e4e9d View commit details
    Browse the repository at this point in the history
  39. Add Minetest 0.4 support

    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    b74b92b View commit details
    Browse the repository at this point in the history
  40. 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)
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    79ed3f1 View commit details
    Browse the repository at this point in the history
  41. 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.
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    7b72364 View commit details
    Browse the repository at this point in the history
  42. Update .luacheckrc and fix warnings

    Changes to reduce formatting warnings will be committed separately
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    44e68d8 View commit details
    Browse the repository at this point in the history
  43. Trim trailing spaces

    This eliminates most luacheck formatting warnings
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    1312bf6 View commit details
    Browse the repository at this point in the history
  44. text/docs/formatting changes

    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    2f7614b View commit details
    Browse the repository at this point in the history
  45. text changes

    Also a minor change to prevent surface portals from appearing in a grid pattern in MT 0.4
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    1ffd88f View commit details
    Browse the repository at this point in the history
  46. Configuration menu
    Copy the full SHA
    4297b31 View commit details
    Browse the repository at this point in the history
  47. blasts extinguish portals

    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    fe17efe View commit details
    Browse the repository at this point in the history
  48. Configuration menu
    Copy the full SHA
    6b5b09b View commit details
    Browse the repository at this point in the history
  49. Configuration menu
    Copy the full SHA
    2f02ab3 View commit details
    Browse the repository at this point in the history
  50. Configuration menu
    Copy the full SHA
    4d4a343 View commit details
    Browse the repository at this point in the history
  51. 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.
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    0d9bf52 View commit details
    Browse the repository at this point in the history
  52. drop portal shape images to 2bit

    Save some bits. Unfortunately PNG can't do 3bit-indexed images :(
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    e2960e9 View commit details
    Browse the repository at this point in the history
  53. 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)
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    b0f7130 View commit details
    Browse the repository at this point in the history
  54. Use lua schematics instead of .mts files when building portals

    Removes the need for the get_malleated_schematic_filename hack
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    43983d3 View commit details
    Browse the repository at this point in the history
  55. 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
    Treer committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    b31df12 View commit details
    Browse the repository at this point in the history