Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
s_client.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4// Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
5
6#pragma once
7
8#include "cpp_api/s_base.h"
9#include "mapnode.h"
10#include "util/string.h"
11#include "util/pointedthing.h"
12
13#ifdef _CRT_MSVCP_CURRENT
14#include <cstdint>
15#endif
16
18struct ItemStack;
19class Inventory;
20struct ItemDefinition;
21
22class ScriptApiClient : virtual public ScriptApiBase
23{
24public:
25 // Calls when mods are loaded
26 void on_mods_loaded();
27
28 // Calls on_shutdown handlers
29 void on_shutdown();
30
31 // Chat message handlers
32 bool on_sending_message(const std::string &message);
33 bool on_receiving_message(const std::string &message);
34
35 void on_damage_taken(int32_t damage_amount);
36 void on_hp_modification(int32_t newhp);
37 void environment_step(float dtime);
38 void on_formspec_input(const std::string &formname, const StringMap &fields);
39
40 bool on_dignode(v3s16 p, MapNode node);
41 bool on_punchnode(v3s16 p, MapNode node);
42 bool on_placenode(const PointedThing &pointed, const ItemDefinition &item);
43 bool on_item_use(const ItemStack &item, const PointedThing &pointed);
44
45 bool on_inventory_open(Inventory *inventory);
46
47 void setEnv(ClientEnvironment *env);
48};
Definition clientenvironment.h:54
Definition inventory.h:314
Definition s_base.h:64
Definition s_client.h:23
bool on_inventory_open(Inventory *inventory)
Definition s_client.cpp:245
void on_shutdown()
Definition s_client.cpp:30
void on_mods_loaded()
Definition s_client.cpp:15
bool on_placenode(const PointedThing &pointed, const ItemDefinition &item)
Definition s_client.cpp:201
bool on_sending_message(const std::string &message)
Definition s_client.cpp:45
bool on_item_use(const ItemStack &item, const PointedThing &pointed)
Definition s_client.cpp:223
void on_hp_modification(int32_t newhp)
Definition s_client.cpp:97
void environment_step(float dtime)
Definition s_client.cpp:113
void setEnv(ClientEnvironment *env)
Definition s_client.cpp:263
bool on_punchnode(v3s16 p, MapNode node)
Definition s_client.cpp:179
bool on_dignode(v3s16 p, MapNode node)
Definition s_client.cpp:157
void on_formspec_input(const std::string &formname, const StringMap &fields)
Definition s_client.cpp:129
void on_damage_taken(int32_t damage_amount)
Definition s_client.cpp:81
bool on_receiving_message(const std::string &message)
Definition s_client.cpp:63
core::vector3d< s16 > v3s16
Definition irr_v3d.h:13
std::unordered_map< std::string, std::string > StringMap
Definition string.h:65
Definition itemdef.h:66
Definition inventory.h:19
Definition mapnode.h:124
An active object or node which is selected by a ray on the map.
Definition pointedthing.h:22
static std::string p(std::string path)
Definition test_filesys.cpp:53