summaryrefslogtreecommitdiff
path: root/src/cat/LegacyLuaAPI.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2013-01-26 17:15:02 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2013-01-26 17:15:02 (GMT)
commit8e689fdd080ff24b9beb68852ff9b7c74594f119 (patch)
tree0260bce01d5e49427c6cfc364845b1f9e8c0c1d4 /src/cat/LegacyLuaAPI.cpp
parent3e60181dbe8fe291c27f909738a8210111557665 (diff)
parent46b767da0c14745a6cd807637249ec0b5b57b8f1 (diff)
downloadpowder-8e689fdd080ff24b9beb68852ff9b7c74594f119.zip
powder-8e689fdd080ff24b9beb68852ff9b7c74594f119.tar.gz
Merge branch 'master' of github.com:FacialTurd/The-Powder-Toy
Diffstat (limited to 'src/cat/LegacyLuaAPI.cpp')
-rw-r--r--src/cat/LegacyLuaAPI.cpp32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/cat/LegacyLuaAPI.cpp b/src/cat/LegacyLuaAPI.cpp
index 5492e2e..506c910 100644
--- a/src/cat/LegacyLuaAPI.cpp
+++ b/src/cat/LegacyLuaAPI.cpp
@@ -671,16 +671,29 @@ int luatpt_element_func(lua_State *l)
return luaL_error(l, "Invalid element");
}
}
+ else if(lua_isnil(l, 1))
+ {
+ int element = luaL_optint(l, 2, 0);
+ if(element > 0 && element < PT_NUM)
+ {
+ lua_el_func[element] = 0;
+ lua_el_mode[element] = 0;
+ }
+ else
+ {
+ return luaL_error(l, "Invalid element");
+ }
+ }
else
return luaL_error(l, "Not a function");
return 0;
}
-int luacon_graphicsReplacement(GRAPHICS_FUNC_ARGS)
+int luacon_graphicsReplacement(GRAPHICS_FUNC_ARGS, int i)
{
int cache = 0, callret;
lua_rawgeti(luacon_ci->l, LUA_REGISTRYINDEX, lua_gr_func[cpart->type]);
- lua_pushinteger(luacon_ci->l, 0);
+ lua_pushinteger(luacon_ci->l, i);
lua_pushinteger(luacon_ci->l, *colr);
lua_pushinteger(luacon_ci->l, *colg);
lua_pushinteger(luacon_ci->l, *colb);
@@ -715,7 +728,20 @@ int luatpt_graphics_func(lua_State *l)
{
lua_gr_func[element] = function;
luacon_ren->graphicscache[element].isready = 0;
- luacon_sim->elements[element].Graphics = &luacon_graphicsReplacement;
+ return 0;
+ }
+ else
+ {
+ return luaL_error(l, "Invalid element");
+ }
+ }
+ else if (lua_isnil(l, 1))
+ {
+ int element = luaL_optint(l, 2, 0);
+ if(element > 0 && element < PT_NUM)
+ {
+ lua_gr_func[element] = 0;
+ luacon_ren->graphicscache[element].isready = 0;
return 0;
}
else