forked from Mirrors/openclonk
Add IsEditor script function
Returns if the host is running in editor (not adjusted in savegames).qteditor
parent
513d51384f
commit
16a770703a
|
@ -21,6 +21,7 @@
|
|||
#include "object/C4Def.h"
|
||||
#include "object/C4DefList.h"
|
||||
#include "game/C4Game.h"
|
||||
#include "game/C4Application.h"
|
||||
#include "network/C4Network2.h"
|
||||
|
||||
// *** C4GameRes
|
||||
|
@ -517,6 +518,7 @@ void C4GameParameters::CompileFunc(StdCompiler *pComp, C4Scenario *pScenario)
|
|||
pComp->Value(mkNamingAdapt(MaxPlayers, "MaxPlayers", !pScenario ? 0 : pScenario->Head.MaxPlayer));
|
||||
pComp->Value(mkNamingAdapt(AllowDebug, "AllowDebug", true));
|
||||
pComp->Value(mkNamingAdapt(IsNetworkGame, "IsNetworkGame", false));
|
||||
pComp->Value(mkNamingAdapt(IsEditor, "IsEditor", !!::Application.isEditor));
|
||||
pComp->Value(mkNamingAdapt(ControlRate, "ControlRate", -1));
|
||||
pComp->Value(mkNamingAdapt(AutoFrameSkip, "AutoFrameSkip", false));
|
||||
pComp->Value(mkNamingAdapt(Rules, "Rules", !pScenario ? C4IDList() : pScenario->Game.Rules));
|
||||
|
|
|
@ -112,6 +112,9 @@ public:
|
|||
// Original network game? Also set in replays of network games for sync safety
|
||||
bool IsNetworkGame;
|
||||
|
||||
// Originally hosted in editor (also in replays from editor)
|
||||
bool IsEditor;
|
||||
|
||||
// Control rate
|
||||
int32_t ControlRate;
|
||||
|
||||
|
|
|
@ -1311,6 +1311,8 @@ static C4Object * FnEditCursor(C4PropList * _this)
|
|||
|
||||
static bool FnIsNetwork(C4PropList * _this) { return Game.Parameters.IsNetworkGame; }
|
||||
|
||||
static bool FnIsEditor(C4PropList * _this) { return Game.Parameters.IsEditor; }
|
||||
|
||||
// undocumented!
|
||||
static C4String *FnGetLeague(C4PropList * _this, long idx)
|
||||
{
|
||||
|
@ -2768,6 +2770,7 @@ void InitGameFunctionMap(C4AulScriptEngine *pEngine)
|
|||
F(DoBaseProduction);
|
||||
F(GainMissionAccess);
|
||||
F(IsNetwork);
|
||||
F(IsEditor);
|
||||
F(GetLeague);
|
||||
::AddFunc(p, "TestMessageBoard", FnTestMessageBoard, false);
|
||||
::AddFunc(p, "CallMessageBoard", FnCallMessageBoard, false);
|
||||
|
|
Loading…
Reference in New Issue