X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;ds=sidebyside;f=src%2Fgamedef.h;h=bc0ee14c31e0f42558f0c73179ac4d394ba79273;hb=4a7c97c5f6f5e110c587de1569c4ffe53f2c2ef4;hp=7e3da4cacf8e29d7bbcdc1034f4cf3463136e5bd;hpb=c3b279750ece0b5144bf8e973d55108347462223;p=minetest.git diff --git a/src/gamedef.h b/src/gamedef.h index 7e3da4cac..bc0ee14c3 100644 --- a/src/gamedef.h +++ b/src/gamedef.h @@ -17,28 +17,29 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef GAMEDEF_HEADER -#define GAMEDEF_HEADER +#pragma once #include +#include #include "irrlichttypes.h" class IItemDefManager; -class INodeDefManager; +class NodeDefManager; class ICraftDefManager; class ITextureSource; -class ISoundManager; class IShaderSource; -class MtEventManager; class IRollbackManager; class EmergeManager; class Camera; +class ModChannel; +class ModMetadata; namespace irr { namespace scene { class IAnimatedMesh; class ISceneManager; }} +struct ModSpec; /* An interface for fetching game-global definitions like tool and mapnode properties @@ -50,51 +51,32 @@ class IGameDef // These are thread-safe IF they are not edited while running threads. // Thus, first they are set up and then they are only read. virtual IItemDefManager* getItemDefManager()=0; - virtual INodeDefManager* getNodeDefManager()=0; + virtual const NodeDefManager* getNodeDefManager()=0; virtual ICraftDefManager* getCraftDefManager()=0; - // This is always thread-safe, but referencing the irrlicht texture - // pointers in other threads than main thread will make things explode. - virtual ITextureSource* getTextureSource()=0; - - virtual IShaderSource* getShaderSource()=0; - // Used for keeping track of names/ids of unknown nodes virtual u16 allocateUnknownNodeId(const std::string &name)=0; - // Only usable on the client - virtual ISoundManager* getSoundManager()=0; - virtual MtEventManager* getEventManager()=0; - virtual scene::IAnimatedMesh* getMesh(const std::string &filename) - { return NULL; } - virtual scene::ISceneManager* getSceneManager()=0; - - virtual Camera* getCamera() - { return NULL; } - virtual void setCamera(Camera *camera) {} - // Only usable on the server, and NOT thread-safe. It is usable from the // environment thread. - virtual IRollbackManager* getRollbackManager(){return NULL;} - - // Only usable on the server. Thread safe if not written while running threads. - virtual EmergeManager *getEmergeManager() { return NULL; } - - // Used on the client - virtual bool checkLocalPrivilege(const std::string &priv) - { return false; } + virtual IRollbackManager* getRollbackManager() { return NULL; } // Shorthands IItemDefManager *idef() { return getItemDefManager(); } - INodeDefManager *ndef() { return getNodeDefManager(); } + const NodeDefManager *ndef() { return getNodeDefManager(); } ICraftDefManager *cdef() { return getCraftDefManager(); } - ITextureSource *tsrc() { return getTextureSource(); } - ISoundManager *sound() { return getSoundManager(); } - IShaderSource *shsrc() { return getShaderSource(); } - MtEventManager *event() { return getEventManager(); } - IRollbackManager *rollback() { return getRollbackManager();} - EmergeManager *emerge() { return getEmergeManager(); } + IRollbackManager *rollback() { return getRollbackManager(); } + + virtual const std::vector &getMods() const = 0; + virtual const ModSpec* getModSpec(const std::string &modname) const = 0; + virtual std::string getWorldPath() const { return ""; } + virtual std::string getModStoragePath() const = 0; + virtual bool registerModStorage(ModMetadata *storage) = 0; + virtual void unregisterModStorage(const std::string &name) = 0; + + virtual bool joinModChannel(const std::string &channel) = 0; + virtual bool leaveModChannel(const std::string &channel) = 0; + virtual bool sendModChannelMessage(const std::string &channel, + const std::string &message) = 0; + virtual ModChannel *getModChannel(const std::string &channel) = 0; }; - -#endif -