Add animated particle support

Also implements an ignition failure sound.
This commit is contained in:
Treer
2019-07-27 19:50:59 +10:00
parent 98ca59b580
commit c934cfa481
7 changed files with 96 additions and 57 deletions

View File

@ -48,7 +48,9 @@ Call these functions only at load time:
* Unregisters the portal from the engine, and deletes the entry with key
`name` from `nether.registered_portals` and associated internal tables.
* Returns true on success
* register_portal_ignition_item(name)
* register_portal_ignition_item(name, ignition_failure_sound)
* ignition_failure_sound is optional, it plays any time an attempt to use
the item occurs if a portal is not ignited.
@ -58,31 +60,45 @@ Portal definition
Used by `nether.register_portal`.
{
shape = PortalShape_Traditional,
shape = PortalShape_Traditional,
-- optional.
wormhole_node_name = "nether:portal",
wormhole_node_name = "nether:portal",
-- optional. Allows a custom wormhole node to be specified.
-- Useful if you want the portals to have a different post_effect_color
-- or texture.
wormhole_node_color = 0,
wormhole_node_color = 0,
-- A value from 0 to 7 corresponding to the color of pixels in
-- nether_portals_palette.png:
-- 0 traditional/magenta
-- 1 black
-- 2 blue
-- 3 green
-- 4 cyan
-- 5 red
-- 6 yellow
-- 7 white
-- 0 traditional/magenta
-- 1 black
-- 2 blue
-- 3 green
-- 4 cyan
-- 5 red
-- 6 yellow
-- 7 white
particle_color = "#808",
particle_color = "#808",
-- Optional. Will default to a colour matching the wormhole_node_color
-- if not specified.
frame_node_name = "default:obsidian",
particle_texture = "image.png",
-- Optional. Animation and particle scale may also be specified, e.g:
-- particle_texture = {
-- name = "nether_particle_anim1.png",
-- animation = {
-- type = "vertical_frames",
-- aspect_w = 7,
-- aspect_h = 7,
-- length = 1,
-- },
-- scale = 1.5
-- },
-- See lua_api.txt for Tile Animation definition
frame_node_name = "default:obsidian",
-- Required. For best results, have your portal constructed of a
-- material nobody else is using.
@ -100,7 +116,7 @@ Used by `nether.register_portal`.
-- Required. Return true if a portal at pos is in the realm, rather
than the surface world.
find_realm_anchorPos = function(surface_anchorPos),
find_realm_anchorPos = function(surface_anchorPos),
-- Required. Return a position in the realm that a portal created at
-- surface_anchorPos will link to.
-- Return an anchorPos or anchorPos, orientation
@ -110,7 +126,7 @@ Used by `nether.register_portal`.
-- orientation, otherwise the existing portal could be overwritten by
-- a new one with the orientation of the surface portal.
find_surface_anchorPos = function(realm_anchorPos),
find_surface_anchorPos = function(realm_anchorPos),
-- Optional. If you don't implement this then a position near the
-- surface will be picked.
-- Return an anchorPos or (anchorPos, orientation)
@ -120,16 +136,16 @@ Used by `nether.register_portal`.
-- orientation, otherwise the existing portal could be overwritten by
-- a new one with the orientation of the realm portal.
on_run_wormhole = function(portalDef, anochorPos, orientation),
on_run_wormhole = function(portalDef, anochorPos, orientation),
-- invoked once per second per portal
on_extinguish = function(portalDef, anochorPos, orientation),
on_extinguish = function(portalDef, anochorPos, orientation),
-- invoked when a portal is extinguished, including when the portal
-- it connected to was extinguished.
on_player_teleported = function(portalDef, player, oldPos, newPos),
-- invoked immediately after a player is teleported
on_ignite = function(portalDef, anochorPos, orientation)
-- invoked when a player or mesecon ignites a portal
on_created = function(portalDef, anochorPos, orientation)
on_created = function(portalDef, anochorPos, orientation)
-- invoked when a portal's remote twin is created, usually when a
-- player travels through a portal for the first time.
}
}