diff options
| author | jacob1 <jfu614@gmail.com> | 2013-01-09 04:28:41 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2013-01-09 04:28:41 (GMT) |
| commit | 9d67dd61e8fc6bd229c4cf451635cf6bb1e96567 (patch) | |
| tree | c778d61aab4aafba288d3c87032c4c1500f3a6b9 /src/cat/LegacyLuaAPI.cpp | |
| parent | 162a8ecba57a3cea84149aa89d6eee742c1e2cea (diff) | |
| download | powder-9d67dd61e8fc6bd229c4cf451635cf6bb1e96567.zip powder-9d67dd61e8fc6bd229c4cf451635cf6bb1e96567.tar.gz | |
re-add tpt.display_mode, check element id's in tpt.set_property, tpt.get_script error with no args
Diffstat (limited to 'src/cat/LegacyLuaAPI.cpp')
| -rw-r--r-- | src/cat/LegacyLuaAPI.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/cat/LegacyLuaAPI.cpp b/src/cat/LegacyLuaAPI.cpp index c6a41e1..04d1866 100644 --- a/src/cat/LegacyLuaAPI.cpp +++ b/src/cat/LegacyLuaAPI.cpp @@ -1004,12 +1004,10 @@ int luatpt_set_property(lua_State* l) } else { t = luaL_optint(l, 2, 0); } - //TODO Element ID check - //if (format == 3 && (t<0 || t>=PT_NUM)) - // return luaL_error(l, "Unrecognised element number '%d'", t); + if (format == CommandInterface::FormatInt && (t<0 || t>=PT_NUM || !luacon_sim->elements[t].Enabled)) + return luaL_error(l, "Unrecognised element number '%d'", t); } else { name = (char*)luaL_optstring(l, 2, "dust"); - //if (!console_parse_type(name, &t, NULL)) if((t = luacon_ci->GetParticleType(std::string(name)))==-1) return luaL_error(l, "Unrecognised element '%s'", name); } @@ -1690,11 +1688,17 @@ int luatpt_heat(lua_State* l) luacon_sim->legacy_enable = (heatstate==1?0:1); return 0; } + int luatpt_cmode_set(lua_State* l) { - //TODO IMPLEMENT - return luaL_error(l, "cmode_set: Deprecated"); + int cmode = luaL_optint(l, 1, 0); + if (cmode >= 0 && cmode <= 10) + luacon_controller->LoadRenderPreset(cmode); + else + return luaL_error(l, "Invalid display mode"); + return 0; } + int luatpt_setfire(lua_State* l) { int firesize = luaL_optint(l, 2, 4); @@ -1725,7 +1729,10 @@ int luatpt_getscript(lua_State* l) fileid = std::string(luaL_optstring(l, 2, "")); run_script = luaL_optint(l, 3, 0); if(!fileauthor.length() || !fileid.length()) + { + lastError = "Script Author or ID not given"; goto fin; + } if(!ConfirmPrompt::Blocking("Do you want to install script?", fileid, "Install")) goto fin; |
