Merge pull request #7323 from IvanSavenko/scripting

[1.8] Lua scripting support part 2
This commit is contained in:
Ivan Savenko
2026-05-28 22:32:13 +03:00
committed by GitHub
261 changed files with 3092 additions and 4657 deletions
+2 -5
View File
@@ -33,7 +33,7 @@ namespace spells
namespace effects
{
class Registry;
class SpellEffectService;
}
}
@@ -59,10 +59,7 @@ public:
virtual const BattleFieldService * battlefields() const = 0;
virtual const ObstacleService * obstacles() const = 0;
virtual const IGameSettings * engineSettings() const = 0;
virtual const spells::effects::Registry * spellEffects() const = 0;
virtual spells::effects::Registry * spellEffects() = 0;
//TODO: put map object types registry access here
virtual const spells::effects::SpellEffectService * spellEffects() const = 0;
};
VCMI_LIB_NAMESPACE_END
+6 -28
View File
@@ -14,9 +14,10 @@
VCMI_LIB_NAMESPACE_BEGIN
class Services;
class JsonNode;
class ServerCallback;
namespace spells::effects
{
class SpellEffectService;
}
namespace scripting
{
@@ -28,20 +29,6 @@ class DLL_LINKAGE Context
{
public:
virtual ~Context() = default;
virtual void run() = 0;
virtual JsonNode callGlobal(const std::string & name, const JsonNode & parameters) = 0;
virtual void setGlobal(const std::string & name, int value) = 0;
virtual void setGlobal(const std::string & name, const std::string & value) = 0;
virtual void setGlobal(const std::string & name, double value) = 0;
virtual void setGlobal(const std::string & name, const JsonNode & value) = 0;
virtual void getGlobal(const std::string & name, int & value) = 0;
virtual void getGlobal(const std::string & name, std::string & value) = 0;
virtual void getGlobal(const std::string & name, double & value) = 0;
virtual void getGlobal(const std::string & name, JsonNode & value) = 0;
};
class DLL_LINKAGE Script
@@ -49,7 +36,7 @@ class DLL_LINKAGE Script
public:
virtual ~Script() = default;
virtual std::string getJsonKey() const = 0;
virtual std::string getIdentifier() const = 0;
virtual const std::string & getSource() const = 0;
};
@@ -66,16 +53,7 @@ class DLL_LINKAGE Service
public:
virtual ~Service() = default;
virtual std::unique_ptr<Pool> createPoolInstance(const Environment * ENV) const = 0;
};
class DLL_LINKAGE Module
{
public:
virtual ~Module() = default;
virtual void loadObject(const std::string & scope, const std::string & name, const JsonNode & data) = 0;
virtual void afterLoadFinalization() = 0;
virtual void installScripting(spells::effects::SpellEffectService * spellEffects) = 0;
virtual std::unique_ptr<Pool> createPoolInstance(const Environment * ENV) const = 0;