mirror of
https://github.com/OgelGames/fakelib.git
synced 2025-07-18 16:30:34 +02:00
Compare commits
4 Commits
c1cf529712
...
v1.1.0
Author | SHA1 | Date | |
---|---|---|---|
b565ca2c40 | |||
10c67ce6af | |||
730f88ff07 | |||
26580085f3 |
8
API.md
8
API.md
@ -1,5 +1,7 @@
|
||||
# API Documentation
|
||||
|
||||
This documentation covers the API specific to `fakelib`. For documentation of the functionality provided by the fake player, metatdata and inventory, refer to the [Lua API](https://github.com/minetest/minetest/blob/master/doc/lua_api.md), as they function the same as the real thing.
|
||||
|
||||
## Quick Links
|
||||
|
||||
- [`fakelib.is_player(x)`](#fakelibis_playerx)
|
||||
@ -59,7 +61,7 @@ Creates a new fake player.
|
||||
|
||||
#### **`fakelib.create_inventory([sizes])`**
|
||||
|
||||
Creates a new fake player.
|
||||
Creates a new fake inventory.
|
||||
|
||||
**Arguments**
|
||||
|
||||
@ -67,7 +69,7 @@ Creates a new fake player.
|
||||
|
||||
#### **`fakelib.create_metadata([data])`**
|
||||
|
||||
Creates a new fake player.
|
||||
Creates a new fake metadata object.
|
||||
|
||||
**Arguments**
|
||||
|
||||
@ -134,4 +136,4 @@ local data = {
|
||||
energy = 300,
|
||||
}
|
||||
local meta = fakelib.create_metadata(data)
|
||||
```
|
||||
```
|
||||
|
@ -139,7 +139,7 @@ function fake_inventory:set_stack(listname, i, stack)
|
||||
stack = ItemStack(stack)
|
||||
i = math.floor(i)
|
||||
local list = self.lists[tostring(listname)]
|
||||
if not list or not list[i] or stack:is_empty() then
|
||||
if not list or not list[i] then
|
||||
return false
|
||||
end
|
||||
list[i] = stack
|
||||
|
24
player.lua
24
player.lua
@ -141,6 +141,8 @@ function fake_player:get_player_control()
|
||||
end
|
||||
controls.LMB = controls.dig
|
||||
controls.RMB = controls.place
|
||||
controls.movement_x = 0
|
||||
controls.movement_y = 0
|
||||
return controls
|
||||
end
|
||||
|
||||
@ -236,6 +238,10 @@ function fake_player.get_breath()
|
||||
return 10
|
||||
end
|
||||
|
||||
function fake_player.get_camera()
|
||||
return {mode = "any"}
|
||||
end
|
||||
|
||||
function fake_player.get_children()
|
||||
return {}
|
||||
end
|
||||
@ -255,6 +261,14 @@ function fake_player.get_eye_offset()
|
||||
return vector.zero(), vector.zero(), vector.zero()
|
||||
end
|
||||
|
||||
function fake_player.get_flags()
|
||||
return {
|
||||
breathing = true,
|
||||
drowning = true,
|
||||
node_damage = true,
|
||||
}
|
||||
end
|
||||
|
||||
function fake_player.get_formspec_prepend()
|
||||
return ""
|
||||
end
|
||||
@ -457,15 +471,17 @@ do
|
||||
"settexturemod", "setvelocity", "setyaw",
|
||||
-- Non-functional get/set functions
|
||||
"add_velocity", "get_attach", "get_attribute", "get_day_night_ratio",
|
||||
"get_observers", "get_effective_observers",
|
||||
"hud_add", "hud_change", "hud_get", "hud_remove", "hud_set_flags",
|
||||
"hud_set_hotbar_image", "hud_set_hotbar_itemcount",
|
||||
"hud_set_hotbar_selected_image", "override_day_night_ratio",
|
||||
"set_animation", "set_animation_frame_speed", "set_armor_groups",
|
||||
"set_attach", "set_attribute", "set_bone_override", "set_bone_position",
|
||||
"set_breath", "set_clouds", "set_detach", "set_eye_offset",
|
||||
"set_formspec_prepend", "set_fov", "set_hp", "set_inventory_formspec",
|
||||
"set_lighting", "set_local_animation", "set_minimap_modes", "set_moon",
|
||||
"set_nametag_attributes", "set_physics_override",
|
||||
"set_breath", "set_camera", "set_clouds", "set_detach",
|
||||
"set_eye_offset", "set_formspec_prepend", "set_flags", "set_fov",
|
||||
"set_hp", "set_inventory_formspec", "set_lighting",
|
||||
"set_local_animation", "set_minimap_modes", "set_moon",
|
||||
"set_nametag_attributes", "set_observers", "set_physics_override",
|
||||
"set_properties", "set_sky", "set_stars", "set_sun",
|
||||
-- Other functions that do nothing
|
||||
"punch", "respawn", "right_click", "send_mapblock",
|
||||
|
Reference in New Issue
Block a user