summaryrefslogtreecommitdiffstats
path: root/src/Bindings
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2015-01-11 22:12:26 +0100
committerTycho <work.tycho+git@gmail.com>2015-01-11 22:12:26 +0100
commit2a9664d6ca8aa9eb4f554301e4d9b0ec33b465ce (patch)
tree86e5b6b66d4791bd64485313db23d7f281f59ab5 /src/Bindings
parentCreated new type cTickTime and rewrote cWorld::TickThread to use it (diff)
downloadcuberite-2a9664d6ca8aa9eb4f554301e4d9b0ec33b465ce.tar
cuberite-2a9664d6ca8aa9eb4f554301e4d9b0ec33b465ce.tar.gz
cuberite-2a9664d6ca8aa9eb4f554301e4d9b0ec33b465ce.tar.bz2
cuberite-2a9664d6ca8aa9eb4f554301e4d9b0ec33b465ce.tar.lz
cuberite-2a9664d6ca8aa9eb4f554301e4d9b0ec33b465ce.tar.xz
cuberite-2a9664d6ca8aa9eb4f554301e4d9b0ec33b465ce.tar.zst
cuberite-2a9664d6ca8aa9eb4f554301e4d9b0ec33b465ce.zip
Diffstat (limited to 'src/Bindings')
-rw-r--r--src/Bindings/LuaState.cpp7
-rw-r--r--src/Bindings/LuaState.h1
-rw-r--r--src/Bindings/Plugin.h2
-rw-r--r--src/Bindings/PluginLua.cpp2
-rw-r--r--src/Bindings/PluginLua.h2
-rw-r--r--src/Bindings/PluginManager.cpp2
-rw-r--r--src/Bindings/PluginManager.h2
7 files changed, 13 insertions, 5 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index 2f5d173fd..4bc9906ee 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -839,6 +839,13 @@ void cLuaState::Push(void * a_Ptr)
m_NumCurrentFunctionArgs += 1;
}
+void cLuaState::Push(std::chrono::milliseconds a_Value)
+{
+ ASSERT(IsValid());
+
+ tolua_pushnumber(m_LuaState, a_Value.count());
+ m_NumCurrentFunctionArgs += 1;
+}
diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h
index c13e36188..7ac4120e1 100644
--- a/src/Bindings/LuaState.h
+++ b/src/Bindings/LuaState.h
@@ -217,6 +217,7 @@ public:
void Push(Vector3d * a_Vector);
void Push(Vector3i * a_Vector);
void Push(void * a_Ptr);
+ void Push(std::chrono::milliseconds a_time);
/** Retrieve value at a_StackPos, if it is a valid bool. If not, a_Value is unchanged */
void GetStackValue(int a_StackPos, bool & a_Value);
diff --git a/src/Bindings/Plugin.h b/src/Bindings/Plugin.h
index b5944e9cb..6210dbed4 100644
--- a/src/Bindings/Plugin.h
+++ b/src/Bindings/Plugin.h
@@ -104,7 +104,7 @@ public:
virtual bool OnWeatherChanged (cWorld & a_World) = 0;
virtual bool OnWeatherChanging (cWorld & a_World, eWeather & a_NewWeather) = 0;
virtual bool OnWorldStarted (cWorld & a_World) = 0;
- virtual bool OnWorldTick (cWorld & a_World, float a_Dt, int a_LastTickDurationMSec) = 0;
+ virtual bool OnWorldTick (cWorld & a_World, std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_LastTickDurationMSec) = 0;
/** Handles the command split into a_Split, issued by player a_Player.
Command permissions have already been checked.
diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp
index cc3146610..500913e76 100644
--- a/src/Bindings/PluginLua.cpp
+++ b/src/Bindings/PluginLua.cpp
@@ -1430,7 +1430,7 @@ bool cPluginLua::OnWorldStarted(cWorld & a_World)
-bool cPluginLua::OnWorldTick(cWorld & a_World, float a_Dt, int a_LastTickDurationMSec)
+bool cPluginLua::OnWorldTick(cWorld & a_World, std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_LastTickDurationMSec)
{
cCSLock Lock(m_CriticalSection);
cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_WORLD_TICK];
diff --git a/src/Bindings/PluginLua.h b/src/Bindings/PluginLua.h
index ad3f82b42..f443f5fc0 100644
--- a/src/Bindings/PluginLua.h
+++ b/src/Bindings/PluginLua.h
@@ -128,7 +128,7 @@ public:
virtual bool OnWeatherChanged (cWorld & a_World) override;
virtual bool OnWeatherChanging (cWorld & a_World, eWeather & a_NewWeather) override;
virtual bool OnWorldStarted (cWorld & a_World) override;
- virtual bool OnWorldTick (cWorld & a_World, float a_Dt, int a_LastTickDurationMSec) override;
+ virtual bool OnWorldTick (cWorld & a_World, std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_LastTickDurationMSec) override;
virtual bool HandleCommand(const AStringVector & a_Split, cPlayer & a_Player) override;
diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp
index fad0a36d2..58faf54d3 100644
--- a/src/Bindings/PluginManager.cpp
+++ b/src/Bindings/PluginManager.cpp
@@ -1394,7 +1394,7 @@ bool cPluginManager::CallHookWorldStarted(cWorld & a_World)
-bool cPluginManager::CallHookWorldTick(cWorld & a_World, float a_Dt, int a_LastTickDurationMSec)
+bool cPluginManager::CallHookWorldTick(cWorld & a_World, std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_LastTickDurationMSec)
{
FIND_HOOK(HOOK_WORLD_TICK);
VERIFY_HOOK;
diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h
index d4b82376a..7b35e92c4 100644
--- a/src/Bindings/PluginManager.h
+++ b/src/Bindings/PluginManager.h
@@ -237,7 +237,7 @@ public:
bool CallHookWeatherChanged (cWorld & a_World);
bool CallHookWeatherChanging (cWorld & a_World, eWeather & a_NewWeather);
bool CallHookWorldStarted (cWorld & a_World);
- bool CallHookWorldTick (cWorld & a_World, float a_Dt, int a_LastTickDurationMSec);
+ bool CallHookWorldTick (cWorld & a_World, std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_LastTickDurationMSec);
bool DisablePlugin(const AString & a_PluginName); // tolua_export
bool LoadPlugin (const AString & a_PluginName); // tolua_export