mirror of
https://github.com/minetest/minetest.git
synced 2025-01-11 15:57:29 +01:00
is_player() is no player-only function
This commit is contained in:
parent
02805af36e
commit
b4c3ff6eab
@ -2387,6 +2387,7 @@ This is basically a reference to a C++ `ServerActiveObject`
|
|||||||
* `position`: `{x=num, y=num, z=num}` (relative)
|
* `position`: `{x=num, y=num, z=num}` (relative)
|
||||||
* `rotation`: `{x=num, y=num, z=num}`
|
* `rotation`: `{x=num, y=num, z=num}`
|
||||||
* `set_properties(object property table)`
|
* `set_properties(object property table)`
|
||||||
|
* `is_player()`: returns true for players, false otherwise
|
||||||
|
|
||||||
##### LuaEntitySAO-only (no-op for other objects)
|
##### LuaEntitySAO-only (no-op for other objects)
|
||||||
* `setvelocity({x=num, y=num, z=num})`
|
* `setvelocity({x=num, y=num, z=num})`
|
||||||
@ -2404,7 +2405,6 @@ This is basically a reference to a C++ `ServerActiveObject`
|
|||||||
* `get_luaentity()`
|
* `get_luaentity()`
|
||||||
|
|
||||||
##### Player-only (no-op for other objects)
|
##### Player-only (no-op for other objects)
|
||||||
* `is_player()`: true for players, false for others
|
|
||||||
* `get_player_name()`: returns `""` if is not a player
|
* `get_player_name()`: returns `""` if is not a player
|
||||||
* `get_look_dir()`: get camera direction as a unit vector
|
* `get_look_dir()`: get camera direction as a unit vector
|
||||||
* `get_look_pitch()`: pitch in radians
|
* `get_look_pitch()`: pitch in radians
|
||||||
|
@ -557,6 +557,16 @@ int ObjectRef::l_set_properties(lua_State *L)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// is_player(self)
|
||||||
|
int ObjectRef::l_is_player(lua_State *L)
|
||||||
|
{
|
||||||
|
NO_MAP_LOCK_REQUIRED;
|
||||||
|
ObjectRef *ref = checkobject(L, 1);
|
||||||
|
Player *player = getplayer(ref);
|
||||||
|
lua_pushboolean(L, (player != NULL));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* LuaEntitySAO-only */
|
/* LuaEntitySAO-only */
|
||||||
|
|
||||||
// setvelocity(self, {x=num, y=num, z=num})
|
// setvelocity(self, {x=num, y=num, z=num})
|
||||||
@ -705,16 +715,6 @@ int ObjectRef::l_get_luaentity(lua_State *L)
|
|||||||
|
|
||||||
/* Player-only */
|
/* Player-only */
|
||||||
|
|
||||||
// is_player(self)
|
|
||||||
int ObjectRef::l_is_player(lua_State *L)
|
|
||||||
{
|
|
||||||
NO_MAP_LOCK_REQUIRED;
|
|
||||||
ObjectRef *ref = checkobject(L, 1);
|
|
||||||
Player *player = getplayer(ref);
|
|
||||||
lua_pushboolean(L, (player != NULL));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// is_player_connected(self)
|
// is_player_connected(self)
|
||||||
int ObjectRef::l_is_player_connected(lua_State *L)
|
int ObjectRef::l_is_player_connected(lua_State *L)
|
||||||
{
|
{
|
||||||
|
@ -120,6 +120,9 @@ private:
|
|||||||
// set_properties(self, properties)
|
// set_properties(self, properties)
|
||||||
static int l_set_properties(lua_State *L);
|
static int l_set_properties(lua_State *L);
|
||||||
|
|
||||||
|
// is_player(self)
|
||||||
|
static int l_is_player(lua_State *L);
|
||||||
|
|
||||||
/* LuaEntitySAO-only */
|
/* LuaEntitySAO-only */
|
||||||
|
|
||||||
// setvelocity(self, {x=num, y=num, z=num})
|
// setvelocity(self, {x=num, y=num, z=num})
|
||||||
@ -156,9 +159,6 @@ private:
|
|||||||
|
|
||||||
/* Player-only */
|
/* Player-only */
|
||||||
|
|
||||||
// is_player(self)
|
|
||||||
static int l_is_player(lua_State *L);
|
|
||||||
|
|
||||||
// is_player_connected(self)
|
// is_player_connected(self)
|
||||||
static int l_is_player_connected(lua_State *L);
|
static int l_is_player_connected(lua_State *L);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user