mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-04-22 15:41:57 +02:00
Unmark some Lua tool callbacks as interface events
A future change will ensure that tools kept active by e.g. holding a mouse button have their appropriate callbacks run exactly once every simulation frame, which will make their "potency" constant from the simulation's point of view in terms of timescale. A past change already allows simulation frames to happen without a corresponding tick event in an interface context, which is when tool callbacks would be run. This necessitates unmarking some tool callbacks as interface events, as they will be called from a simulation context at times. A list of API changes follows. name | change --------------------------------|---------------------------------------- [tool].Drag callback | unmade an interface event [tool].Draw callback | unmade an interface event [tool].DrawFill callback | unmade an interface event [tool].DrawLine callback | unmade an interface event [tool].DrawRect callback | unmade an interface event [tool].Perform callback | unmade an interface event
This commit is contained in:
parent
d4363b7f0a
commit
91e4b0d173
@ -94,7 +94,7 @@ static int luaPerformWrapper(SimTool *tool, Simulation *sim, Particle *cpart, in
|
||||
lua_pushboolean(L, tool->altBehaviour);
|
||||
lua_pushinteger(L, brushX);
|
||||
lua_pushinteger(L, brushY);
|
||||
if (tpt_lua_pcall(L, 9, 1, 0, eventTraitInterface))
|
||||
if (tpt_lua_pcall(L, 9, 1, 0, eventTraitNone))
|
||||
{
|
||||
lsi->Log(CommandInterface::LogError, "In perform func: " + LuaGetError());
|
||||
lua_pop(L, 1);
|
||||
@ -153,7 +153,7 @@ static void luaDragWrapper(SimTool *tool, Simulation *sim, const Brush &brush, u
|
||||
lua_pushboolean(L, tool->shiftBehaviour);
|
||||
lua_pushboolean(L, tool->ctrlBehaviour);
|
||||
lua_pushboolean(L, tool->altBehaviour);
|
||||
if (tpt_lua_pcall(L, 9, 0, 0, eventTraitInterface))
|
||||
if (tpt_lua_pcall(L, 9, 0, 0, eventTraitNone))
|
||||
{
|
||||
lsi->Log(CommandInterface::LogError, "In drag func: " + LuaGetError());
|
||||
lua_pop(L, 1);
|
||||
@ -177,7 +177,7 @@ static void luaDrawWrapper(SimTool *tool, Simulation *sim, const Brush &brush, u
|
||||
lua_pushboolean(L, tool->shiftBehaviour);
|
||||
lua_pushboolean(L, tool->ctrlBehaviour);
|
||||
lua_pushboolean(L, tool->altBehaviour);
|
||||
if (tpt_lua_pcall(L, 7, 0, 0, eventTraitInterface))
|
||||
if (tpt_lua_pcall(L, 7, 0, 0, eventTraitNone))
|
||||
{
|
||||
lsi->Log(CommandInterface::LogError, "In draw func: " + LuaGetError());
|
||||
lua_pop(L, 1);
|
||||
@ -203,7 +203,7 @@ static void luaDrawLineWrapper(SimTool *tool, Simulation *sim, const Brush &brus
|
||||
lua_pushboolean(L, tool->shiftBehaviour);
|
||||
lua_pushboolean(L, tool->ctrlBehaviour);
|
||||
lua_pushboolean(L, tool->altBehaviour);
|
||||
if (tpt_lua_pcall(L, 9, 0, 0, eventTraitInterface))
|
||||
if (tpt_lua_pcall(L, 9, 0, 0, eventTraitNone))
|
||||
{
|
||||
lsi->Log(CommandInterface::LogError, "In drawLine func: " + LuaGetError());
|
||||
lua_pop(L, 1);
|
||||
@ -229,7 +229,7 @@ static void luaDrawRectWrapper(SimTool *tool, Simulation *sim, const Brush &brus
|
||||
lua_pushboolean(L, tool->shiftBehaviour);
|
||||
lua_pushboolean(L, tool->ctrlBehaviour);
|
||||
lua_pushboolean(L, tool->altBehaviour);
|
||||
if (tpt_lua_pcall(L, 9, 0, 0, eventTraitInterface))
|
||||
if (tpt_lua_pcall(L, 9, 0, 0, eventTraitNone))
|
||||
{
|
||||
lsi->Log(CommandInterface::LogError, "In drawRect func: " + LuaGetError());
|
||||
lua_pop(L, 1);
|
||||
@ -253,7 +253,7 @@ static void luaDrawFillWrapper(SimTool *tool, Simulation *sim, const Brush &brus
|
||||
lua_pushboolean(L, tool->shiftBehaviour);
|
||||
lua_pushboolean(L, tool->ctrlBehaviour);
|
||||
lua_pushboolean(L, tool->altBehaviour);
|
||||
if (tpt_lua_pcall(L, 7, 0, 0, eventTraitInterface))
|
||||
if (tpt_lua_pcall(L, 7, 0, 0, eventTraitNone))
|
||||
{
|
||||
lsi->Log(CommandInterface::LogError, "In drawFill func: " + LuaGetError());
|
||||
lua_pop(L, 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user