Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
gamedef.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
5#pragma once
6
7#include <string>
8#include <vector>
9#include "irrlichttypes.h"
10
11class IItemDefManager;
12class NodeDefManager;
14class ITextureSource;
15class IShaderSource;
17class EmergeManager;
18class Camera;
19class ModChannel;
20class ModStorage;
22struct SubgameSpec;
23struct ModSpec;
24struct ModIPCStore;
25
26namespace irr::scene {
27 class IAnimatedMesh;
28 class ISceneManager;
29}
30
31/*
32 An interface for fetching game-global definitions like tool and
33 mapnode properties
34*/
36{
37public:
38 // These are thread-safe IF they are not edited while running threads.
39 // Thus, first they are set up and then they are only read.
43
44 // Used for keeping track of names/ids of unknown nodes
45 virtual u16 allocateUnknownNodeId(const std::string &name)=0;
46
47 // Only usable on the server, and NOT thread-safe. It is usable from the
48 // environment thread.
49 virtual IRollbackManager* getRollbackManager() { return NULL; }
50
51 // Only usable on server.
52 virtual ModIPCStore *getModIPCStore() { return nullptr; }
53
54 // Shorthands
55 // TODO: these should be made const-safe so that a const IGameDef* is
56 // actually usable
58 const NodeDefManager *ndef() { return getNodeDefManager(); }
61
62 virtual const std::vector<ModSpec> &getMods() const = 0;
63 virtual const ModSpec* getModSpec(const std::string &modname) const = 0;
64 virtual const SubgameSpec* getGameSpec() const { return nullptr; }
65 virtual std::string getWorldPath() const { return ""; }
66 virtual std::string getModDataPath() const { return ""; }
68
69 virtual bool joinModChannel(const std::string &channel) = 0;
70 virtual bool leaveModChannel(const std::string &channel) = 0;
71 virtual bool sendModChannelMessage(const std::string &channel,
72 const std::string &message) = 0;
73 virtual ModChannel *getModChannel(const std::string &channel) = 0;
74};
Definition camera.h:68
Definition emerge.h:117
Definition craftdef.h:390
Definition gamedef.h:36
virtual std::string getWorldPath() const
Definition gamedef.h:65
virtual const SubgameSpec * getGameSpec() const
Definition gamedef.h:64
ICraftDefManager * cdef()
Definition gamedef.h:59
const NodeDefManager * ndef()
Definition gamedef.h:58
virtual const std::vector< ModSpec > & getMods() const =0
virtual bool leaveModChannel(const std::string &channel)=0
virtual bool sendModChannelMessage(const std::string &channel, const std::string &message)=0
virtual u16 allocateUnknownNodeId(const std::string &name)=0
virtual const NodeDefManager * getNodeDefManager()=0
virtual bool joinModChannel(const std::string &channel)=0
virtual IRollbackManager * getRollbackManager()
Definition gamedef.h:49
virtual std::string getModDataPath() const
Definition gamedef.h:66
IRollbackManager * rollback()
Definition gamedef.h:60
virtual IItemDefManager * getItemDefManager()=0
virtual ModIPCStore * getModIPCStore()
Definition gamedef.h:52
virtual ModChannel * getModChannel(const std::string &channel)=0
virtual const ModSpec * getModSpec(const std::string &modname) const =0
virtual ModStorageDatabase * getModStorageDatabase()=0
virtual ICraftDefManager * getCraftDefManager()=0
IItemDefManager * idef()
Definition gamedef.h:57
Definition itemdef.h:129
Definition rollback_interface.h:97
Definition shader.h:201
Definition texturesource.h:36
Definition modchannels.h:23
Definition database.h:74
Definition mods.h:99
This class is for getting the actual properties of nodes from their content ID.
Definition nodedef.h:541
Definition clientmap.h:30
Definition server.h:146
Definition mods.h:25
Definition subgames.h:15