Luanti 5.15.0-dev
 
Loading...
Searching...
No Matches
dummygamedef.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) 2022 TurkeyMcMac, Jude Melton-Houghton <jwmhjwmh@gmail.com>
5
6#pragma once
7
8#include "gamedef.h"
9#include "itemdef.h"
10#include "nodedef.h"
11#include "craftdef.h"
12#include "content/mods.h"
14#if CHECK_CLIENT_BUILD()
15#include "client/node_visuals.h"
16#endif
17
18class DummyGameDef : public IGameDef {
19public:
27
29 {
31 delete m_craftdef;
32 delete m_nodedef;
33 delete m_itemdef;
34 }
35
36 bool isClient() override { return false; }
38 const NodeDefManager *getNodeDefManager() override { return m_nodedef; }
41
42 u16 allocateUnknownNodeId(const std::string &name) override
43 {
44 return m_nodedef->allocateDummy(name);
45 }
46
47 const std::vector<ModSpec> &getMods() const override
48 {
49 static std::vector<ModSpec> emptymodspec;
50 return emptymodspec;
51 }
52 const ModSpec* getModSpec(const std::string &modname) const override { return nullptr; }
54
55 bool joinModChannel(const std::string &channel) override { return false; }
56 bool leaveModChannel(const std::string &channel) override { return false; }
57 bool sendModChannelMessage(const std::string &channel, const std::string &message) override
58 {
59 return false;
60 }
61 ModChannel *getModChannel(const std::string &channel) override { return nullptr; }
62
63protected:
68
69#if CHECK_CLIENT_BUILD()
70 static NodeVisuals *constructNodeVisuals(ContentFeatures *f) { return new NodeVisuals(f); }
71#endif
72};
Definition database-dummy.h:14
Definition dummygamedef.h:18
u16 allocateUnknownNodeId(const std::string &name) override
Definition dummygamedef.h:42
const ModSpec * getModSpec(const std::string &modname) const override
Definition dummygamedef.h:52
ICraftDefManager * m_craftdef
Definition dummygamedef.h:66
bool isClient() override
Definition dummygamedef.h:36
~DummyGameDef()
Definition dummygamedef.h:28
NodeDefManager * getWritableNodeDefManager()
Definition dummygamedef.h:39
ModStorageDatabase * getModStorageDatabase() override
Definition dummygamedef.h:53
ModStorageDatabase * m_mod_storage_database
Definition dummygamedef.h:67
const std::vector< ModSpec > & getMods() const override
Definition dummygamedef.h:47
DummyGameDef()
Definition dummygamedef.h:20
bool leaveModChannel(const std::string &channel) override
Definition dummygamedef.h:56
ICraftDefManager * getCraftDefManager() override
Definition dummygamedef.h:40
ModChannel * getModChannel(const std::string &channel) override
Definition dummygamedef.h:61
bool joinModChannel(const std::string &channel) override
Definition dummygamedef.h:55
NodeDefManager * m_nodedef
Definition dummygamedef.h:65
const NodeDefManager * getNodeDefManager() override
Definition dummygamedef.h:38
bool sendModChannelMessage(const std::string &channel, const std::string &message) override
Definition dummygamedef.h:57
IItemDefManager * getItemDefManager() override
Definition dummygamedef.h:37
IItemDefManager * m_itemdef
Definition dummygamedef.h:64
Definition craftdef.h:388
Definition gamedef.h:26
Definition itemdef.h:146
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
content_t allocateDummy(const std::string &name)
Definition nodedef.cpp:1003
IWritableCraftDefManager * createCraftDefManager()
Definition craftdef.cpp:1246
IWritableItemDefManager * createItemDefManager()
Definition itemdef.cpp:580
NodeDefManager * createNodeDefManager()
Definition nodedef.cpp:1205
Definition nodedef.h:294
Definition mods.h:18
Definition node_visuals.h:23