aboutsummaryrefslogtreecommitdiff
path: root/src/player.h
Commit message (Collapse)AuthorAge
* CraftItem rework and Lua interfaceKahrl2011-11-29
|
* Player movement speed and node access distance checkingPerttu Ahola2011-11-29
|
* on_newplayer and on_respawnplayer callbacksPerttu Ahola2011-11-29
|
* Clean mapnode.h and fix other files accordinglyPerttu Ahola2011-11-29
|
* GameDef compilesPerttu Ahola2011-11-29
|
* Create framework for getting rid of global definitions of ↵Perttu Ahola2011-11-29
| | | | node/tool/item/whatever types
* Scripting WIP: dynamic object stuffPerttu Ahola2011-11-29
|
* ServerRemotePlayer implements ServerActiveObjectPerttu Ahola2011-11-29
|
* Better player damage prevention when falling on unloaded blocks, not ↵Perttu Ahola2011-10-16
| | | | involving getting stuck in there.
* Simplistic wielded tool lighting, added setMeshVerticesColor to utility.h ↵Kahrl2011-09-21
| | | | and refactored some other code into calls of that
* fix a numerical problem, but tool is still jitteryKahrl2011-09-20
|
* Added sprite extruderKahrl2011-09-19
|
* Display which tool the player is holdingJacobF2011-09-07
| | | | And some simple animation when trying to dig...
* Pause in unloaded territory instead of collideJacobF2011-09-06
|
* Keep track of player itemGiuseppe Bilotta2011-08-11
|
* Refactor player's eye position codingGiuseppe Bilotta2011-08-11
| | | | | Collect the player's eye position coding in a Player method, and use it in client to pass the eye position information to the game.
* Introduce Player::getLightPositionGiuseppe Bilotta2011-08-11
| | | | | This is currently only used in the lighting update for remote players in client.
* Respect base virtual functions' signaturesGiuseppe Bilotta2011-08-08
|
* Ladders implemented!Mark Holmquist2011-08-01
|
* Fixed handling of inventory in creative mode (normal inventory is not ↵Perttu Ahola2011-07-30
| | | | trashed anymore), fixed mese pick speed, added some forgotten stuff
* hopefully fixed the privilege problemsPerttu Ahola2011-05-29
| | | | | --HG-- extra : rebase_source : 9826d20176134a53ff232816a10407465d8c0f50
* player passwords and privileges in world/auth.txtPerttu Ahola2011-05-29
| | | | | --HG-- extra : rebase_source : 7260636295d9068fbeeddf4143c89f2b8a91446c
* Added 'shout' player privilegeCiaran Gultnieks2011-05-23
|
* Passwords - password entry at main menu, stored and checked by serverCiaran Gultnieks2011-05-20
|
* Privileges to/from string conversion functions standalone, not static membersCiaran Gultnieks2011-05-16
|
* Improved server commands and added player permissions.Ciaran Gultnieks2011-05-16
| | | | | --HG-- extra : rebase_source : 178fe08f10b7de3ebaba088bd24faad795114216
* Code refactoring; split half of main.cpp to game.cpp.Perttu Ahola2011-04-23
|
* Some work-in-progress in hp and mobs and a frightening amount of random fixes.Perttu Ahola2011-04-21
|
* Fixed some problems with crafting and inventoryPerttu Ahola2011-04-11
|
* Temporary commit; lots of test code and stuffPerttu Ahola2011-02-21
|
* fixed bug in sneakingPerttu Ahola2011-02-14
|
* added sneaking/crouching and changelogPerttu Ahola2011-02-14
|
* bug-fixin'Perttu Ahola2011-02-08
|
* mapgen tweakingPerttu Ahola2011-02-06
|
* This map generator is starting to look pretty good now... also, disabled ↵Perttu Ahola2011-02-01
| | | | loading player position from disk because map is regenerated always.
* Now texture handling is fast. Also now players are saved on disk.Perttu Ahola2011-01-28
|
* Players are left on server while server is running. No passwords yet.Perttu Ahola2011-01-15
|
* tweaking around, including mapgen, player speed in water, settingsPerttu Ahola2011-01-15
|
* some work-in-progressPerttu Ahola2010-12-22
|
* added dedicated server build without irrlichtPerttu Ahola2010-12-19
|
* better waterPerttu Ahola2010-11-30
|
* license stuffPerttu Ahola2010-11-29
| | | | | --HG-- rename : src/licensecomment.txt => licensecomment.txt
* Initial filesPerttu Ahola2010-11-27
data.c_str(), staticdata.size()); lua_pushinteger(L, dtime_s); setOriginFromTable(object); PCALL_RES(lua_pcall(L, 3, 0, error_handler)); } else { lua_pop(L, 1); } lua_pop(L, 2); // Pop object and error handler } void ScriptApiEntity::luaentity_Deactivate(u16 id) { SCRIPTAPI_PRECHECKHEADER verbosestream << "scriptapi_luaentity_deactivate: id=" << id << std::endl; int error_handler = PUSH_ERROR_HANDLER(L); // Get the entity luaentity_get(L, id); int object = lua_gettop(L); // Get on_deactivate lua_getfield(L, -1, "on_deactivate"); if (!lua_isnil(L, -1)) { luaL_checktype(L, -1, LUA_TFUNCTION); lua_pushvalue(L, object); setOriginFromTable(object); PCALL_RES(lua_pcall(L, 1, 0, error_handler)); } else { lua_pop(L, 1); } lua_pop(L, 2); // Pop object and error handler } void ScriptApiEntity::luaentity_Remove(u16 id) { SCRIPTAPI_PRECHECKHEADER verbosestream << "scriptapi_luaentity_rm: id=" << id << std::endl; // Get core.luaentities table lua_getglobal(L, "core"); lua_getfield(L, -1, "luaentities"); luaL_checktype(L, -1, LUA_TTABLE); int objectstable = lua_gettop(L); // Set luaentities[id] = nil lua_pushnumber(L, id); // Push id lua_pushnil(L); lua_settable(L, objectstable); lua_pop(L, 2); // pop luaentities, core } std::string ScriptApiEntity::luaentity_GetStaticdata(u16 id) { SCRIPTAPI_PRECHECKHEADER //infostream<<"scriptapi_luaentity_get_staticdata: id="<<id<<std::endl; int error_handler = PUSH_ERROR_HANDLER(L); // Get core.luaentities[id] luaentity_get(L, id); int object = lua_gettop(L); // Get get_staticdata function lua_getfield(L, -1, "get_staticdata"); if (lua_isnil(L, -1)) { lua_pop(L, 2); // Pop entity and get_staticdata return ""; } luaL_checktype(L, -1, LUA_TFUNCTION); lua_pushvalue(L, object); // self setOriginFromTable(object); PCALL_RES(lua_pcall(L, 1, 1, error_handler)); lua_remove(L, object); lua_remove(L, error_handler); size_t len = 0; const char *s = lua_tolstring(L, -1, &len); lua_pop(L, 1); // Pop static data return std::string(s, len); } void ScriptApiEntity::luaentity_GetProperties(u16 id, ServerActiveObject *self, ObjectProperties *prop) { SCRIPTAPI_PRECHECKHEADER //infostream<<"scriptapi_luaentity_get_properties: id="<<id<<std::endl; // Get core.luaentities[id] luaentity_get(L, id); // Set default values that differ from ObjectProperties defaults prop->hp_max = 10; // Deprecated: read object properties directly read_object_properties(L, -1, self, prop, getServer()->idef()); // Read initial_properties lua_getfield(L, -1, "initial_properties"); read_object_properties(L, -1, self, prop, getServer()->idef()); lua_pop(L, 1); } void ScriptApiEntity::luaentity_Step(u16 id, float dtime, const collisionMoveResult *moveresult) { SCRIPTAPI_PRECHECKHEADER int error_handler = PUSH_ERROR_HANDLER(L); // Get core.luaentities[id] luaentity_get(L, id); int object = lua_gettop(L); // State: object is at top of stack // Get step function lua_getfield(L, -1, "on_step"); if (lua_isnil(L, -1)) { lua_pop(L, 2); // Pop on_step and entity return; } luaL_checktype(L, -1, LUA_TFUNCTION); lua_pushvalue(L, object); // self lua_pushnumber(L, dtime); // dtime /* moveresult */ if (moveresult) push_collision_move_result(L, *moveresult); else lua_pushnil(L); setOriginFromTable(object); PCALL_RES(lua_pcall(L, 3, 0, error_handler)); lua_pop(L, 2); // Pop object and error handler } // Calls entity:on_punch(ObjectRef puncher, time_from_last_punch, // tool_capabilities, direction, damage) bool ScriptApiEntity::luaentity_Punch(u16 id, ServerActiveObject *puncher, float time_from_last_punch, const ToolCapabilities *toolcap, v3f dir, s16 damage) { SCRIPTAPI_PRECHECKHEADER //infostream<<"scriptapi_luaentity_step: id="<<id<<std::endl; int error_handler = PUSH_ERROR_HANDLER(L); // Get core.luaentities[id] luaentity_get(L,id); int object = lua_gettop(L); // State: object is at top of stack // Get function lua_getfield(L, -1, "on_punch"); if (lua_isnil(L, -1)) { lua_pop(L, 2); // Pop on_punch and entity return false; } luaL_checktype(L, -1, LUA_TFUNCTION); lua_pushvalue(L, object); // self objectrefGetOrCreate(L, puncher); // Clicker reference lua_pushnumber(L, time_from_last_punch); push_tool_capabilities(L, *toolcap); push_v3f(L, dir); lua_pushnumber(L, damage); setOriginFromTable(object); PCALL_RES(lua_pcall(L, 6, 1, error_handler)); bool retval = readParam<bool>(L, -1); lua_pop(L, 2); // Pop object and error handler return retval; } // Calls entity[field](ObjectRef self, ObjectRef sao) bool ScriptApiEntity::luaentity_run_simple_callback(u16 id, ServerActiveObject *sao, const char *field) { SCRIPTAPI_PRECHECKHEADER int error_handler = PUSH_ERROR_HANDLER(L); // Get core.luaentities[id] luaentity_get(L, id); int object = lua_gettop(L); // State: object is at top of stack // Get function lua_getfield(L, -1, field); if (lua_isnil(L, -1)) { lua_pop(L, 2); // Pop callback field and entity return false; } luaL_checktype(L, -1, LUA_TFUNCTION); lua_pushvalue(L, object); // self objectrefGetOrCreate(L, sao); // killer reference setOriginFromTable(object); PCALL_RES(lua_pcall(L, 2, 1, error_handler)); bool retval = readParam<bool>(L, -1); lua_pop(L, 2); // Pop object and error handler return retval; } bool ScriptApiEntity::luaentity_on_death(u16 id, ServerActiveObject *killer) { return luaentity_run_simple_callback(id, killer, "on_death"); } // Calls entity:on_rightclick(ObjectRef clicker) void ScriptApiEntity::luaentity_Rightclick(u16 id, ServerActiveObject *clicker) { luaentity_run_simple_callback(id, clicker, "on_rightclick"); } void ScriptApiEntity::luaentity_on_attach_child(u16 id, ServerActiveObject *child) { luaentity_run_simple_callback(id, child, "on_attach_child"); } void ScriptApiEntity::luaentity_on_detach_child(u16 id, ServerActiveObject *child) { luaentity_run_simple_callback(id, child, "on_detach_child"); } void ScriptApiEntity::luaentity_on_detach(u16 id, ServerActiveObject *parent) { luaentity_run_simple_callback(id, parent, "on_detach"); }