add identifier constants based on the display name to the lua api
This commit is contained in:
parent
d76650f7e6
commit
3a738846a3
@ -1141,6 +1141,13 @@ void LuaScriptInterface::initElementsAPI()
|
||||
{
|
||||
lua_pushinteger(l, i);
|
||||
lua_setfield(l, elementsAPI, luacon_sim->elements[i].Identifier);
|
||||
char realIdentifier[20];
|
||||
sprintf(realIdentifier, "DEFAULT_PT_%s", luacon_sim->elements[i].Name);
|
||||
if (i != 0 && i != PT_NBHL && i != PT_NWHL && strcmp(luacon_sim->elements[i].Identifier, realIdentifier))
|
||||
{
|
||||
lua_pushinteger(l, i);
|
||||
lua_setfield(l, elementsAPI, realIdentifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3016,7 +3016,7 @@ int Simulation::create_part(int p, int x, int y, int tv)
|
||||
case PT_PLSM:
|
||||
parts[i].life = rand()%150+50;
|
||||
break;
|
||||
case PT_HFLM:
|
||||
case PT_CFLM:
|
||||
parts[i].life = rand()%150+50;
|
||||
break;
|
||||
case PT_LAVA:
|
||||
@ -3678,7 +3678,7 @@ void Simulation::update_particles_i(int start, int inc)
|
||||
(bmap[y/CELL][x/CELL]==WL_DESTROYALL) ||
|
||||
(bmap[y/CELL][x/CELL]==WL_ALLOWLIQUID && elements[t].Falldown!=2) ||
|
||||
(bmap[y/CELL][x/CELL]==WL_ALLOWSOLID && elements[t].Falldown!=1) ||
|
||||
(bmap[y/CELL][x/CELL]==WL_ALLOWGAS && !(elements[t].Properties&TYPE_GAS)) || //&& elements[t].Falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE && parts[i].type!=PT_HFLM) ||
|
||||
(bmap[y/CELL][x/CELL]==WL_ALLOWGAS && !(elements[t].Properties&TYPE_GAS)) || //&& elements[t].Falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE && parts[i].type!=PT_CFLM) ||
|
||||
(bmap[y/CELL][x/CELL]==WL_ALLOWENERGY && !(elements[t].Properties&TYPE_ENERGY)) ||
|
||||
(bmap[y/CELL][x/CELL]==WL_DETECT && (t==PT_METL || t==PT_SPRK)) ||
|
||||
(bmap[y/CELL][x/CELL]==WL_EWALL && !emap[y/CELL][x/CELL])) && (t!=PT_STKM) && (t!=PT_STKM2) && (t!=PT_FIGH)))
|
||||
@ -4038,7 +4038,7 @@ void Simulation::update_particles_i(int start, int inc)
|
||||
if (elements[t].State==ST_GAS&&elements[parts[i].type].State!=ST_GAS)
|
||||
pv[y/CELL][x/CELL] += 0.50f;
|
||||
part_change_type(i,x,y,t);
|
||||
if (t==PT_FIRE||t==PT_PLSM||t==PT_HFLM)
|
||||
if (t==PT_FIRE||t==PT_PLSM||t==PT_CFLM)
|
||||
parts[i].life = rand()%50+120;
|
||||
if (t==PT_LAVA) {
|
||||
if (parts[i].ctype==PT_BRMT) parts[i].ctype = PT_BMTL;
|
||||
|
@ -60,9 +60,9 @@ int Element_ANAR::update(UPDATE_FUNC_ARGS)
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if ((r&0xFF)==PT_HFLM && !(rand()%7))
|
||||
if ((r&0xFF)==PT_CFLM && !(rand()%7))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_HFLM);
|
||||
sim->part_change_type(i,x,y,PT_CFLM);
|
||||
parts[i].life = rand()%150+50;
|
||||
parts[r>>8].temp = parts[i].temp = 0;
|
||||
sim->pv[y/CELL][x/CELL] -= 0.5;
|
||||
|
@ -57,11 +57,11 @@ int Element_C5::update(UPDATE_FUNC_ARGS)
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if (((r&0xFF)!=PT_C5 && parts[r>>8].temp<100 && sim->elements[r&0xFF].HeatConduct && ((r&0xFF)!=PT_HSWC||parts[r>>8].life==10)) || (r&0xFF)==PT_HFLM)
|
||||
if (((r&0xFF)!=PT_C5 && parts[r>>8].temp<100 && sim->elements[r&0xFF].HeatConduct && ((r&0xFF)!=PT_HSWC||parts[r>>8].life==10)) || (r&0xFF)==PT_CFLM)
|
||||
{
|
||||
if (!(rand()%6))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_HFLM);
|
||||
sim->part_change_type(i,x,y,PT_CFLM);
|
||||
parts[r>>8].temp = parts[i].temp = 0;
|
||||
parts[i].life = rand()%150+50;
|
||||
sim->pv[y/CELL][x/CELL] += 1.5;
|
||||
|
@ -4,8 +4,8 @@ extern "C"
|
||||
#include "hmap.h"
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementClass Element_HFLM PT_HFLM 68
|
||||
Element_HFLM::Element_HFLM()
|
||||
//#TPT-Directive ElementClass Element_CFLM PT_CFLM 68
|
||||
Element_CFLM::Element_CFLM()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_HFLM";
|
||||
Name = "CFLM";
|
||||
@ -48,11 +48,11 @@ Element_HFLM::Element_HFLM()
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = NULL;
|
||||
Graphics = &Element_HFLM::graphics;
|
||||
Graphics = &Element_CFLM::graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_HFLM static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_HFLM::graphics(GRAPHICS_FUNC_ARGS)
|
||||
//#TPT-Directive ElementHeader Element_CFLM static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_CFLM::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
{
|
||||
int caddress = restrict_flt(restrict_flt((float)((int)(cpart->life/2)), 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3);
|
||||
@ -72,4 +72,4 @@ int Element_HFLM::graphics(GRAPHICS_FUNC_ARGS)
|
||||
}
|
||||
|
||||
|
||||
Element_HFLM::~Element_HFLM() {}
|
||||
Element_CFLM::~Element_CFLM() {}
|
Loading…
Reference in New Issue
Block a user