aboutsummaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
Commit message (Expand)AuthorAge
* Cpp11 initializers 2 (#5999)Loïc Blot2017-06-17
* Revert custom player collision box and step height commitsparamat2017-05-09
* Custom step height: Fix implementationparamat2017-05-08
* Use stepheight from CAO instead of hardcoded valueSapier2017-05-06
* Make players respect makes_footstep_sound in the object propertiesTeTpaAka2017-05-06
* Sneak: Improve and fix various thingsSmallJoker2017-05-03
* Sneak glitch: Set default to falseparamat2017-04-22
* Sneak: Add option for old move codeparamat2017-04-17
* Sneak glitch: Detect ledge for 2-node climb-upparamat2017-04-11
* Sneak: Fix sneaking on free-floating lower-half slabssfan52017-03-29
* Sneak: Fix stair lower step bug and ladder in 1x1 hole bugssfan52017-03-29
* Sneak: Replicate sneak ladder in new code, is optionalsfan52017-03-26
* Sneak: Fix various problems with sneakingsfan52017-03-16
* Footsteps: Fix offset footstep and shallow water sound bugsparamat2017-02-12
* Cleanup some header inclusions to improve compilation timesLoic Blot2017-01-11
* Environment & IGameDef code refactoring (#4985)Ner'zhul2017-01-09
* Optimize/adjust blocks/ActiveObjects sent at the server based on client setti...lhofhansl2016-11-30
* PlayerSAO/LocalPlayer refactor: (#4612)Ner'zhul2016-10-30
* RemotePlayer/LocalPlayer Player base class proper separation (code cleanup) (...Loic Blot2016-10-08
* Initial Gamepad supportest312016-06-03
* Android: Increase player_stepheight for thicker snow nodeboxMaksim Gamarnik2016-05-06
* Fix player teleportation bug whilst sneakingHybridDog2016-03-14
* Nodebox: Allow nodeboxes to "connect"Auke Kok2016-03-12
* Player::accelerateHorizontal/Vertical should be member of LocalPlayerLoic Blot2016-02-14
* Don't pass non-const references to collision methodsest312016-01-29
* Fix misc. MinGW and Valgrind warningskwolekr2015-11-08
* Only go fast in autorun if fast move is enabledest312015-11-03
* Fix jittering sounds on entities (fixes #2974)BlockMen2015-10-26
* Fix sneaking (fixes #665 and #3045)BlockMen2015-08-15
* Fix detection of sneaking nodegregorycu2015-08-06
* Fix "bouncy" blocksMiner592015-08-02
* Only retrieve always_fly_fast setting onceSmallJoker2015-05-30
* Add some missing getter functions to the lua APITeTpaAka2015-05-28
* Move globals from main.cpp to more sane locationsCraig Robbins2015-04-01
* For usages of assert() that are meant to persist in Release builds (when NDEB...Craig Robbins2015-03-07
* ABMHandler and player_collisions use sequential read/write. Switch from std::...Loic Blot2015-03-04
* Fix all warnings and remove -Wno-unused-but-set cflagkwolekr2015-01-18
* Fix invalid stepheight increase calculation on androidsapier2015-01-11
* Increase stepheight on android by 0.5 to smoothen movementsapier2015-01-11
* Remove most exceptions from getNode() (and variants)Craig Robbins2014-11-14
* Implement WieldMeshSceneNode which improves wield mesh renderingKahrl2014-11-08
* Simplify player modification checksShadowNinja2014-10-01
* Add support for interlaced polarized 3d screenssapier2014-05-18
* Bunch of small fixes (coding style, very unlikely errors, warning messages)sapier2014-04-19
* Fix all warnings reported by clangSfan52014-04-15
* Reorder initialization of member variables to make GCC happyShadowNinja2014-04-13
* Add player:set_eye_offset() by @MirceaKitsune and clean upBlockMen2014-04-12
* Add third person viewBlockMen2014-04-12
* Add sneak and sneak_glitch to set_physics_override()PilzAdam2013-12-03
* Use player:set_hotbar_image() instead of hardcoded hotbar.pngPilzAdam2013-09-05
">) { getClient()->setFatalError(e); } } bool ScriptApiClient::on_sending_message(const std::string &message) { SCRIPTAPI_PRECHECKHEADER // Get core.registered_on_chat_messages lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_sending_chat_message"); // Call callbacks lua_pushstring(L, message.c_str()); try { runCallbacks(1, RUN_CALLBACKS_MODE_OR_SC); } catch (LuaError &e) { getClient()->setFatalError(e); return true; } return readParam<bool>(L, -1); } bool ScriptApiClient::on_receiving_message(const std::string &message) { SCRIPTAPI_PRECHECKHEADER // Get core.registered_on_chat_messages lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_receiving_chat_message"); // Call callbacks lua_pushstring(L, message.c_str()); try { runCallbacks(1, RUN_CALLBACKS_MODE_OR_SC); } catch (LuaError &e) { getClient()->setFatalError(e); return true; } return readParam<bool>(L, -1); } void ScriptApiClient::on_damage_taken(int32_t damage_amount) { SCRIPTAPI_PRECHECKHEADER // Get core.registered_on_chat_messages lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_damage_taken"); // Call callbacks lua_pushinteger(L, damage_amount); try { runCallbacks(1, RUN_CALLBACKS_MODE_OR_SC); } catch (LuaError &e) { getClient()->setFatalError(e); } } void ScriptApiClient::on_hp_modification(int32_t newhp) { SCRIPTAPI_PRECHECKHEADER // Get core.registered_on_chat_messages lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_hp_modification"); // Call callbacks lua_pushinteger(L, newhp); try { runCallbacks(1, RUN_CALLBACKS_MODE_OR_SC); } catch (LuaError &e) { getClient()->setFatalError(e); } } void ScriptApiClient::on_death() { SCRIPTAPI_PRECHECKHEADER // Get registered shutdown hooks lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_death"); // Call callbacks try { runCallbacks(0, RUN_CALLBACKS_MODE_FIRST); } catch (LuaError &e) { getClient()->setFatalError(e); } } void ScriptApiClient::environment_step(float dtime) { SCRIPTAPI_PRECHECKHEADER // Get core.registered_globalsteps lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_globalsteps"); // Call callbacks lua_pushnumber(L, dtime); try { runCallbacks(1, RUN_CALLBACKS_MODE_FIRST); } catch (LuaError &e) { getClient()->setFatalError(e); } } void ScriptApiClient::on_formspec_input(const std::string &formname, const StringMap &fields) { SCRIPTAPI_PRECHECKHEADER // Get core.registered_on_chat_messages lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_formspec_input"); // Call callbacks // param 1 lua_pushstring(L, formname.c_str()); // param 2 lua_newtable(L); StringMap::const_iterator it; for (it = fields.begin(); it != fields.end(); ++it) { const std::string &name = it->first; const std::string &value = it->second; lua_pushstring(L, name.c_str()); lua_pushlstring(L, value.c_str(), value.size()); lua_settable(L, -3); } try { runCallbacks(2, RUN_CALLBACKS_MODE_OR_SC); } catch (LuaError &e) { getClient()->setFatalError(e); } } bool ScriptApiClient::on_dignode(v3s16 p, MapNode node) { SCRIPTAPI_PRECHECKHEADER const NodeDefManager *ndef = getClient()->ndef(); // Get core.registered_on_dignode lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_dignode"); // Push data push_v3s16(L, p); pushnode(L, node, ndef); // Call functions try { runCallbacks(2, RUN_CALLBACKS_MODE_OR); } catch (LuaError &e) { getClient()->setFatalError(e); return true; } return lua_toboolean(L, -1); } bool ScriptApiClient::on_punchnode(v3s16 p, MapNode node) { SCRIPTAPI_PRECHECKHEADER const NodeDefManager *ndef = getClient()->ndef(); // Get core.registered_on_punchgnode lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_punchnode"); // Push data push_v3s16(L, p); pushnode(L, node, ndef); // Call functions try { runCallbacks(2, RUN_CALLBACKS_MODE_OR); } catch (LuaError &e) { getClient()->setFatalError(e); return true; } return readParam<bool>(L, -1); } bool ScriptApiClient::on_placenode(const PointedThing &pointed, const ItemDefinition &item) { SCRIPTAPI_PRECHECKHEADER // Get core.registered_on_placenode lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_placenode"); // Push data push_pointed_thing(L, pointed, true); push_item_definition(L, item); // Call functions try { runCallbacks(2, RUN_CALLBACKS_MODE_OR); } catch (LuaError &e) { getClient()->setFatalError(e); return true; } return readParam<bool>(L, -1); } bool ScriptApiClient::on_item_use(const ItemStack &item, const PointedThing &pointed) { SCRIPTAPI_PRECHECKHEADER // Get core.registered_on_item_use lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_item_use"); // Push data LuaItemStack::create(L, item); push_pointed_thing(L, pointed, true); // Call functions try { runCallbacks(2, RUN_CALLBACKS_MODE_OR); } catch (LuaError &e) { getClient()->setFatalError(e); return true; } return readParam<bool>(L, -1); } bool ScriptApiClient::on_inventory_open(Inventory *inventory) { SCRIPTAPI_PRECHECKHEADER lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_inventory_open"); std::vector<const InventoryList*> lists = inventory->getLists(); std::vector<const InventoryList*>::iterator iter = lists.begin(); lua_createtable(L, 0, lists.size()); for (; iter != lists.end(); iter++) { const char* name = (*iter)->getName().c_str(); lua_pushstring(L, name); push_inventory_list(L, inventory, name); lua_rawset(L, -3); } try { runCallbacks(1, RUN_CALLBACKS_MODE_OR); } catch (LuaError &e) { getClient()->setFatalError(e); return true; } return readParam<bool>(L, -1); } void ScriptApiClient::setEnv(ClientEnvironment *env) { ScriptApiBase::setEnv(env); }