2024-10-28 15:57:39 +01:00
|
|
|
// Luanti
|
|
|
|
// SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
|
|
|
// Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
|
2017-01-21 15:02:08 +01:00
|
|
|
|
2017-08-17 22:19:39 +02:00
|
|
|
#pragma once
|
2017-01-21 15:02:08 +01:00
|
|
|
|
|
|
|
#include "cpp_api/s_base.h"
|
2017-01-29 17:43:44 +00:00
|
|
|
#include "mapnode.h"
|
2017-04-07 23:22:00 +02:00
|
|
|
#include "util/string.h"
|
2017-05-06 20:12:44 +01:00
|
|
|
#include "util/pointedthing.h"
|
2017-01-24 16:26:15 +00:00
|
|
|
|
|
|
|
#ifdef _CRT_MSVCP_CURRENT
|
|
|
|
#include <cstdint>
|
|
|
|
#endif
|
2017-01-21 15:02:08 +01:00
|
|
|
|
2017-03-17 07:48:29 +01:00
|
|
|
class ClientEnvironment;
|
2023-03-08 22:58:47 +01:00
|
|
|
struct ItemStack;
|
|
|
|
class Inventory;
|
|
|
|
struct ItemDefinition;
|
2017-03-17 07:48:29 +01:00
|
|
|
|
2017-04-07 23:22:00 +02:00
|
|
|
class ScriptApiClient : virtual public ScriptApiBase
|
2017-01-21 15:02:08 +01:00
|
|
|
{
|
|
|
|
public:
|
2018-06-06 12:53:59 +02:00
|
|
|
// Calls when mods are loaded
|
|
|
|
void on_mods_loaded();
|
|
|
|
|
2017-01-21 15:02:08 +01:00
|
|
|
// Calls on_shutdown handlers
|
|
|
|
void on_shutdown();
|
2017-04-08 08:45:58 +02:00
|
|
|
|
2017-01-21 15:02:08 +01:00
|
|
|
// Chat message handlers
|
|
|
|
bool on_sending_message(const std::string &message);
|
|
|
|
bool on_receiving_message(const std::string &message);
|
2017-01-22 00:20:55 +01:00
|
|
|
|
|
|
|
void on_damage_taken(int32_t damage_amount);
|
|
|
|
void on_hp_modification(int32_t newhp);
|
2017-01-22 11:17:41 +01:00
|
|
|
void environment_step(float dtime);
|
2017-01-24 16:26:15 +00:00
|
|
|
void on_formspec_input(const std::string &formname, const StringMap &fields);
|
2017-01-29 17:43:44 +00:00
|
|
|
|
|
|
|
bool on_dignode(v3s16 p, MapNode node);
|
2017-01-29 18:28:38 +00:00
|
|
|
bool on_punchnode(v3s16 p, MapNode node);
|
2017-04-29 12:08:16 +02:00
|
|
|
bool on_placenode(const PointedThing &pointed, const ItemDefinition &item);
|
2017-05-06 20:12:44 +01:00
|
|
|
bool on_item_use(const ItemStack &item, const PointedThing &pointed);
|
2017-03-17 07:48:29 +01:00
|
|
|
|
2017-10-02 22:09:49 +02:00
|
|
|
bool on_inventory_open(Inventory *inventory);
|
|
|
|
|
2017-03-17 07:48:29 +01:00
|
|
|
void setEnv(ClientEnvironment *env);
|
2017-01-21 15:02:08 +01:00
|
|
|
};
|