aboutsummaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-01-22 00:20:55 +0100
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-03-13 23:56:05 +0100
commit9978f5af828550d819890fed1fc56d65838a2c4c (patch)
tree34ba1ca2f7b2607fcd60166419a3ca9ab436e9bb /src/game.cpp
parentcb3a61f8db6b7020dd69f7786a1086f6fe014dfc (diff)
downloadminetest-9978f5af828550d819890fed1fc56d65838a2c4c.tar.gz
minetest-9978f5af828550d819890fed1fc56d65838a2c4c.tar.bz2
minetest-9978f5af828550d819890fed1fc56d65838a2c4c.zip
[CSM] Add on_death, on_hp_modification & oh_damage_taken callbacks (#5093)
* Add on_death callback * Add on_hp_modification & on_damage_taken callbacks * move preview code to preview.lua
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 9868142f7..2e2a8e0c1 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -41,7 +41,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "guiKeyChangeMenu.h"
#include "guiPasswordChange.h"
#include "guiVolumeChange.h"
-#include "hud.h"
#include "mainmenumanager.h"
#include "mapblock.h"
#include "nodedef.h" // Needed for determining pointing to nodes
@@ -61,6 +60,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "version.h"
#include "minimap.h"
#include "mapblock_mesh.h"
+#include "script/clientscripting.h"
#include "sound.h"
@@ -3240,8 +3240,7 @@ void Game::processClientEvents(CameraOrientation *cam, float *damage_flash)
if (event.type == CE_PLAYER_DAMAGE &&
client->getHP() != 0) {
- //u16 damage = event.player_damage.amount;
- //infostream<<"Player damage: "<<damage<<std::endl;
+ client->getScript()->on_damage_taken(event.player_damage.amount);
*damage_flash += 95.0 + 3.2 * event.player_damage.amount;
*damage_flash = MYMIN(*damage_flash, 127.0);
@@ -3259,7 +3258,7 @@ void Game::processClientEvents(CameraOrientation *cam, float *damage_flash)
show_deathscreen(&current_formspec, client, texture_src,
device, &input->joystick);
- chat_backend->addMessage(L"", L"You died.");
+ client->getScript()->on_death();
/* Handle visualization */
*damage_flash = 0;