mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-01 20:12:50 +02:00
re-add tpt.display_mode, check element id's in tpt.set_property, tpt.get_script error with no args
This commit is contained in:
@@ -1004,12 +1004,10 @@ int luatpt_set_property(lua_State* l)
|
|||||||
} else {
|
} else {
|
||||||
t = luaL_optint(l, 2, 0);
|
t = luaL_optint(l, 2, 0);
|
||||||
}
|
}
|
||||||
//TODO Element ID check
|
if (format == CommandInterface::FormatInt && (t<0 || t>=PT_NUM || !luacon_sim->elements[t].Enabled))
|
||||||
//if (format == 3 && (t<0 || t>=PT_NUM))
|
return luaL_error(l, "Unrecognised element number '%d'", t);
|
||||||
// return luaL_error(l, "Unrecognised element number '%d'", t);
|
|
||||||
} else {
|
} else {
|
||||||
name = (char*)luaL_optstring(l, 2, "dust");
|
name = (char*)luaL_optstring(l, 2, "dust");
|
||||||
//if (!console_parse_type(name, &t, NULL))
|
|
||||||
if((t = luacon_ci->GetParticleType(std::string(name)))==-1)
|
if((t = luacon_ci->GetParticleType(std::string(name)))==-1)
|
||||||
return luaL_error(l, "Unrecognised element '%s'", name);
|
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);
|
luacon_sim->legacy_enable = (heatstate==1?0:1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int luatpt_cmode_set(lua_State* l)
|
int luatpt_cmode_set(lua_State* l)
|
||||||
{
|
{
|
||||||
//TODO IMPLEMENT
|
int cmode = luaL_optint(l, 1, 0);
|
||||||
return luaL_error(l, "cmode_set: Deprecated");
|
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 luatpt_setfire(lua_State* l)
|
||||||
{
|
{
|
||||||
int firesize = luaL_optint(l, 2, 4);
|
int firesize = luaL_optint(l, 2, 4);
|
||||||
@@ -1725,7 +1729,10 @@ int luatpt_getscript(lua_State* l)
|
|||||||
fileid = std::string(luaL_optstring(l, 2, ""));
|
fileid = std::string(luaL_optstring(l, 2, ""));
|
||||||
run_script = luaL_optint(l, 3, 0);
|
run_script = luaL_optint(l, 3, 0);
|
||||||
if(!fileauthor.length() || !fileid.length())
|
if(!fileauthor.length() || !fileid.length())
|
||||||
|
{
|
||||||
|
lastError = "Script Author or ID not given";
|
||||||
goto fin;
|
goto fin;
|
||||||
|
}
|
||||||
if(!ConfirmPrompt::Blocking("Do you want to install script?", fileid, "Install"))
|
if(!ConfirmPrompt::Blocking("Do you want to install script?", fileid, "Install"))
|
||||||
goto fin;
|
goto fin;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user