mirror of
https://github.com/mt-mods/xcompat.git
synced 2025-11-02 17:25:34 +01:00
add stairs api (#56)
This commit is contained in:
30
doc/stairs.md
Normal file
30
doc/stairs.md
Normal file
@@ -0,0 +1,30 @@
|
||||
you can use this via `xcompat.stairs.register(nodename, def)`
|
||||
|
||||
an example would be:
|
||||
```lua
|
||||
xcompat.stairs.register(
|
||||
"xcompat_stairs_test:fake_node",
|
||||
core.registered_nodes["xcompat_stairs_test:fake_node"]
|
||||
)
|
||||
```
|
||||
|
||||
if the game you are running on isnt supported (see readme),
|
||||
it falls back to using a polyfill. each backend adds aliases
|
||||
to the polyfill, mainly so that if we add a future backend
|
||||
that ran on polyfill, everything keeps working (yay)
|
||||
|
||||
at this time stairsplus/moreblocks compatibility/upgrading
|
||||
isnt supported, however should be added in the future. for
|
||||
now, in your mod code do something like the following:
|
||||
|
||||
```lua
|
||||
if core.registered_modes("moreblocks") then
|
||||
--call stairs plus
|
||||
else
|
||||
xcompat.stairs.register(node, def)
|
||||
end
|
||||
```
|
||||
|
||||
that way in the future nothing will break when support is
|
||||
added and at your convince the first part of the if can be
|
||||
removed
|
||||
Reference in New Issue
Block a user