Luanti 5.15.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;
15class ModChannel;
17struct SubgameSpec;
18struct ModSpec;
19struct ModIPCStore;
20
21/*
22 An interface for fetching game-global definitions like tool and
23 mapnode properties
24*/
26{
27public:
28 // These are thread-safe IF they are not edited while running threads.
29 // Thus, first they are set up and then they are only read.
33
34 // Used for keeping track of names/ids of unknown nodes
35 virtual u16 allocateUnknownNodeId(const std::string &name)=0;
36
37 // Only usable on the server, and NOT thread-safe. It is usable from the
38 // environment thread.
39 virtual IRollbackManager* getRollbackManager() { return NULL; }
40
41 // Only usable on server.
42 virtual ModIPCStore *getModIPCStore() { return nullptr; }
43
44 // Shorthands
45 // TODO: these should be made const-safe so that a const IGameDef* is
46 // actually usable
48 const NodeDefManager *ndef() { return getNodeDefManager(); }
51
52 virtual const std::vector<ModSpec> &getMods() const = 0;
53 virtual const ModSpec* getModSpec(const std::string &modname) const = 0;
54 virtual const SubgameSpec* getGameSpec() const { return nullptr; }
55 virtual std::string getWorldPath() const { return ""; }
56 virtual std::string getModDataPath() const { return ""; }
58
59 virtual bool joinModChannel(const std::string &channel) = 0;
60 virtual bool leaveModChannel(const std::string &channel) = 0;
61 virtual bool sendModChannelMessage(const std::string &channel,
62 const std::string &message) = 0;
63 virtual ModChannel *getModChannel(const std::string &channel) = 0;
64 virtual bool isClient() = 0;
65};
Definition craftdef.h:388
Definition gamedef.h:26
virtual std::string getWorldPath() const
Definition gamedef.h:55
virtual const SubgameSpec * getGameSpec() const
Definition gamedef.h:54
ICraftDefManager * cdef()
Definition gamedef.h:49
const NodeDefManager * ndef()
Definition gamedef.h:48
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 bool isClient()=0
virtual const NodeDefManager * getNodeDefManager()=0
virtual bool joinModChannel(const std::string &channel)=0
virtual IRollbackManager * getRollbackManager()
Definition gamedef.h:39
virtual std::string getModDataPath() const
Definition gamedef.h:56
IRollbackManager * rollback()
Definition gamedef.h:50
virtual IItemDefManager * getItemDefManager()=0
virtual ModIPCStore * getModIPCStore()
Definition gamedef.h:42
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:47
Definition itemdef.h:146
Definition rollback_interface.h:98
Definition modchannels.h:23
Definition database.h:79
This class is for getting the actual properties of nodes from their content ID.
Definition nodedef.h:509
Definition server.h:157
Definition mods.h:18
Definition subgames.h:14