MCPcopy Create free account
hub / github.com/Segs/Segs / on_lua_update

Method on_lua_update

Projects/CoX/Servers/MapServer/MapInstance.cpp:2893–2913  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2891}
2892
2893void MapInstance::on_lua_update()
2894{
2895 // move all to-remove timers to the end of the m_lua_timers
2896 auto first_to_remove=std::partition(m_lua_timers.begin(),m_lua_timers.end(),[](const auto &t) {
2897 return !t.m_remove;
2898 });
2899 // remove all dead timers first
2900 if(first_to_remove!=m_lua_timers.end())
2901 m_lua_timers.erase(first_to_remove,m_lua_timers.end());
2902 for(const auto &t: m_lua_timers)
2903 {
2904 if(t.m_is_enabled && t.m_on_tick_callback != nullptr)
2905 {
2906 m_scripting_interface->updateMapInstance(this);
2907 int64_t time = getSecsSince2000Epoch();
2908 int64_t diff = time - t.m_start_time;
2909 t.m_on_tick_callback(t.m_start_time, diff, time);
2910 }
2911 }
2912
2913}
2914
2915void MapInstance::on_update_entities()
2916{

Callers

nothing calls this directly

Calls 5

getSecsSince2000EpochFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45
updateMapInstanceMethod · 0.45

Tested by

no test coverage detected