Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
scripting_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 <cassert>
9
10#include "cpp_api/s_base.h"
11#include "cpp_api/s_client.h"
13#include "cpp_api/s_security.h"
14
15class Client;
16class LocalPlayer;
17class Camera;
18class Minimap;
19
21 virtual public ScriptApiBase,
22 public ScriptApiSecurity,
23 public ScriptApiClient,
25{
26public:
28 void on_client_ready(LocalPlayer *localplayer);
29 void on_camera_ready(Camera *camera);
30 void on_minimap_ready(Minimap *minimap);
31
32protected:
33 // from ScriptApiSecurity:
34 bool checkPathInternal(const std::string &abs_path, bool write_required,
35 bool *write_allowed) override {
36 warningstream << "IO API called in client scripting" << std::endl;
37 assert(0);
38 return false;
39 }
40 bool modNamesAreTrusted() override { return true; }
41
42private:
43 virtual void InitializeModApi(lua_State *L, int top);
44};
Definition camera.h:68
Definition scripting_client.h:25
void on_camera_ready(Camera *camera)
Definition scripting_client.cpp:80
virtual void InitializeModApi(lua_State *L, int top)
Definition scripting_client.cpp:51
bool checkPathInternal(const std::string &abs_path, bool write_required, bool *write_allowed) override
Should check if the given path may be accessed.
Definition scripting_client.h:34
bool modNamesAreTrusted() override
Specify if the mod names during init time(!) can be trusted.
Definition scripting_client.h:40
void on_client_ready(LocalPlayer *localplayer)
Definition scripting_client.cpp:75
void on_minimap_ready(Minimap *minimap)
Definition scripting_client.cpp:85
ClientScripting(Client *client)
Definition scripting_client.cpp:25
Definition client.h:105
Definition localplayer.h:50
Definition minimap.h:101
Definition s_base.h:64
Definition s_client.h:23
Definition s_modchannels.h:12
Definition s_security.h:28
thread_local LogStream warningstream
Definition activeobjectmgr.cpp:11