This commit is contained in:
Skivling 2024-06-19 14:14:23 +12:00
parent ff2609a544
commit 516100677e

69
API.md
View File

@ -8,7 +8,7 @@ Please note:
- We will refer to the player piloting the TARDIS as the pilot.
- These API may change in future updates
- These API may change in future updates, **especially v1.3.0**. After that update, most API should be stable.
## `drwho_tardis:register_tardis_exterior(def)`
@ -41,6 +41,49 @@ Makes it very simple to add another TARDIS exterior, which is also added to the
- Does not return anything.
- Ensure that the `name` is unique, otherwise it will override the previous one with that name and break some things.
##### Example usage
```lua
-- Exterior with mesh texture
drwho_tardis:register_tardis_exterior({
name = "green",
texture = "tardis_green.png",
title = "Green",
author = "Skivling"
})
-- Exterior using existing textures (Nodebox drawtype)
drwho_tardis:register_tardis_exterior({
name = "stone",
texture = "default_stone.png",
drawtype = "nodebox",
light = 0,
title = "Stone",
author = "PiDemon"
})
```
## `drwho_tardis:register_in_door_style(def)`
Allows you to create custom styles for the Tardis interior doors.
### Parameters
- `def` (table):
- `texture`: The texture for the door.
- `description`: The player-facing name
- `itemstring`: The itemstring of the door
##### Example usage
```lua
drwho_tardis:register_in_door_style({
texture = "drwho_tardis_inside_door_b.png",
description = "Tardis Interior Door (style B)",
itemstring = "drwho_tardis:in_door_b"
})
```
## `drwho_tardis:register_sonic_device(def)`
Registers a sonic device, whether that be a screwdriver or lipstick (Sarah Jane's, planned). Any item that has the functionality of a sonic.
@ -73,22 +116,40 @@ Registers a sonic device, whether that be a screwdriver or lipstick (Sarah Jane'
- `customname`: This is the itemstring. It defaults to `"drwho_tardis:sonic_"..sonictype.."_"..top.."_"..mid.."_"..bottom`, so if you want it to be part of your mod's modname space, you must use this value, as well as appending the modname with `:` to tell the engine to not care that the modname isn't `drwho_tardis` even though it appears to be registered from that because of the function.
- For example, `:extra_sonics:sonic_playingcards_3` if, for some reason you wanted a pack of cards to have sonic ability. Actually, that doesn't sound like a bad idea...
- For example, `:extra_sonics:sonic_playing_cards_3` if, for some reason you wanted a pack of cards to have sonic ability. Actually, that doesn't sound like a bad idea...
- `tool_capabilities`: A table, allowing you to customize the capabilities of that particular sonic. `full_punch_interval`, `groupcaps.sonic` allows you to change the `uses` and `maxlevel` of it, the higher they are the more durability the sonic has.
- `sounds`: Must be a table where the value `sonic_use` is a custom sound file to play when the sonic is used, and includes the `max_hear_distance`.
### Return value
##### Return value
Returns the full `item_name`.
- It may include the extra `:` if you put your own modname in the `customname`, if so you can remove it with `item_name = item_name:match"^.-:(.+)"`.
### Additional notes
##### Additional notes
* A different API may be added in the future that allows custom sonic functions to be added as long as they don't break the default ones.
- The names of each variable in `def` will most likely change in version `1.3.0` when APIs are cleaned up.
##### Example usage:
```lua
-- Register sonic playing cards as part of the mod 'extra_sonics'
drwho_tardis:register_sonic_device({
gentype = "custom", -- We are specifying the texture
texture = "extra_sonics_playing_cards.png",
sonictype = "playing_cards",
no_creative = false, -- We want it to appear in the creative inventory
customname = ":extra_sonics:sonic_playing_cards", -- itemstring
customdescription = "Sonic Playing Cards", -- player-facing name
})
```
## `drwho_tardis.get:tardis_ext_position(player)`
Returns the exterior position of a certain player's Tardis.