mirror of
https://github.com/a-bad-dev/simple-shooter-game.git
synced 2026-06-09 04:16:30 +00:00
Add the game
This commit is contained in:
parent
25eb4d0283
commit
38caa29558
863 changed files with 36331 additions and 0 deletions
16
mods/xcompat/doc/functions.md
Normal file
16
mods/xcompat/doc/functions.md
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# Functions API
|
||||
|
||||
## `can_interact_with_node(player, pos)`
|
||||
|
||||
returns `bool`
|
||||
|
||||
checks for the ability to interact with a node via:
|
||||
|
||||
* if a player
|
||||
* owner metadata key
|
||||
* `protection_bypass`
|
||||
|
||||
supports
|
||||
|
||||
* minetest game default if present
|
||||
* else polyfill
|
||||
12
mods/xcompat/doc/gameid.md
Normal file
12
mods/xcompat/doc/gameid.md
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# GameId API
|
||||
|
||||
## minetest versions >= 5.7
|
||||
|
||||
simply returns `minetest.get_game_info().id`
|
||||
|
||||
## minetest versions < 5.7
|
||||
|
||||
approximates the gameid value via a hardcoded table of gameid =\> modname,
|
||||
and then checks via `minetest.get_modpath()`. If it fails, it falls
|
||||
back to using `xcompat_unknown_gameid` as the id. See the chart in the
|
||||
readme for which games are supported
|
||||
26
mods/xcompat/doc/materials.md
Normal file
26
mods/xcompat/doc/materials.md
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Materials API
|
||||
|
||||
## Usage
|
||||
|
||||
The materials can be accessed anywhere in your mod with `xcompat.materials.material_name`.
|
||||
|
||||
Behind the scenes, xcompat automatically changes the `xcompat.materials`
|
||||
variable to contain the correct materials for whichever game the mod is
|
||||
launched in.
|
||||
|
||||
## Game support
|
||||
|
||||
See the [the support table in the readme](https://github.com/mt-mods/xcompat/tree/master?tab=readme-ov-file#directly-supported-games-and-mods)
|
||||
for an overview of supported games, and see the contents of `/src/materials/`
|
||||
for the supported materials and their names.
|
||||
|
||||
## Examples
|
||||
|
||||
Writing `xcompat.materials.steel_ingot` returns the string of whichever item
|
||||
would closest represent the `steel_ingot` material in the current game.
|
||||
|
||||
The `/src/materials/mineclonia.lua` file shows what the keys of
|
||||
`xcompat.materials` resolve to when playing Mineclonia, such as
|
||||
`xcompat.materials.steel_ingot` resolving to `mcl_core:iron_ingot`, and
|
||||
`xcompat.materials.mesa_crystal` resolving to `mcl_redstone:redstone` if
|
||||
supported.
|
||||
21
mods/xcompat/doc/player.md
Normal file
21
mods/xcompat/doc/player.md
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# Player API
|
||||
|
||||
## Usage
|
||||
|
||||
The player api can be accessed in your script through `xcompat.player`.
|
||||
|
||||
This object mimics the `player_api` from Minetest Game, and should be a drop-in
|
||||
replacement in most cases. You should be able to simply replace instances
|
||||
of `player_api` in your script with `xcompat.player`.
|
||||
|
||||
|
||||
## Note on `xcompat.player.player_attached`
|
||||
|
||||
Reading & writing to this object works, but because it's a proxy table it can't
|
||||
be looped over.
|
||||
|
||||
Looping over this object would require lua5.2 `__pairs`/`__ipairs` metamethod support.
|
||||
It would be possible to implement support for this through polyfill,
|
||||
using [this method](https://stackoverflow.com/a/77354254)
|
||||
(luajit supports this via 5.2 extensions), but it's not implemented as of now.
|
||||
Additionally see [this engine issue](https://github.com/minetest/minetest/issues/15133).
|
||||
45
mods/xcompat/doc/sounds.md
Normal file
45
mods/xcompat/doc/sounds.md
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# Sound API
|
||||
|
||||
|
||||
## Option 1: Agnostically depend
|
||||
|
||||
You can do this by using a custom field in your node def instead of the `sounds` key.
|
||||
|
||||
```lua
|
||||
minetest.register_node(nodename, {
|
||||
...
|
||||
_sound_def = {
|
||||
key = "",
|
||||
input = {},
|
||||
},
|
||||
...
|
||||
})
|
||||
```
|
||||
|
||||
where:
|
||||
|
||||
* key: string name of the field from the sound api you want to use, for example `node_sound_stone_defaults`
|
||||
* input: table input of fields you want passed to the key field, used to override specific sounds.
|
||||
|
||||
## Option 2: Hard depend
|
||||
|
||||
add this mod to your mod.confs depends and directly call the `sound_api` as follows
|
||||
|
||||
```lua
|
||||
minetest.register_node(nodename, {
|
||||
...
|
||||
sounds = xcompat.sounds.node_sound_stone_defaults(input)
|
||||
...
|
||||
})
|
||||
```
|
||||
|
||||
* input: optional table to override some or all of returned values
|
||||
|
||||
|
||||
## Note
|
||||
|
||||
In some instances, when sounds are defined by strings and the sound doesn't
|
||||
belong to a block or anything mod-specific, xcompat may not be needed. E.g.
|
||||
the sound `"default_dig_choppy"` is accessed in the same way in both Mineclonia
|
||||
and Minetest Game, without xcompat.
|
||||
|
||||
30
mods/xcompat/doc/stairs.md
Normal file
30
mods/xcompat/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
|
||||
20
mods/xcompat/doc/textures.md
Normal file
20
mods/xcompat/doc/textures.md
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# Textures API
|
||||
|
||||
## Usage
|
||||
|
||||
To use a texture in your mod, find the texture you want by looking at one of
|
||||
the files in `/src/texture`, and append its path to `xcompat.textures`.
|
||||
|
||||
If a texture isn't supported for the current game, xcompat creates a solid
|
||||
color texture using texture modifiers as a fallback, ensuring compatibility.
|
||||
|
||||
## Example
|
||||
|
||||
| Path | Result in Minetest Game |
|
||||
| - | - |
|
||||
| xcompat.textures.wool.white | `"wool_white.png"` |
|
||||
| xcompat.textures.wood.apple.planks | `"default_wood.png"` |
|
||||
| xcompat.textures.wood.jungle.leaves | `"default_jungleleaves.png"` |
|
||||
| xcompat.textures.glass.pane | `"default_glass.png"` |
|
||||
|
||||
For games like Minetest and Mineclonia, see the file `/src/textures/minetest.lua`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue