mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-30 11:19:51 +02:00
TPT: Remember ctype when cloning lava
This commit is contained in:
@@ -71,18 +71,26 @@ int Element_BCLN::update(UPDATE_FUNC_ARGS)
|
||||
continue;
|
||||
if ((r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN &&
|
||||
(r&0xFF)!=PT_BCLN && (r&0xFF)!=PT_STKM &&
|
||||
(r&0xFF)!=PT_STKM2 && (r&0xFF)!=PT_PBCN &&
|
||||
(r&0xFF)!=PT_PBCN && (r&0xFF)!=PT_STKM2 &&
|
||||
(r&0xFF)<PT_NUM)
|
||||
{
|
||||
parts[i].ctype = r&0xFF;
|
||||
if ((r&0xFF)==PT_LIFE)
|
||||
if ((r&0xFF)==PT_LIFE || (r&0xFF)==PT_LAVA)
|
||||
parts[i].tmp = parts[r>>8].ctype;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (parts[i].ctype==PT_LIFE) sim->create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype|(parts[i].tmp<<8));
|
||||
else sim->create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
|
||||
else
|
||||
{
|
||||
int np = sim->create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
|
||||
if (np>=0)
|
||||
{
|
||||
if (parts[i].ctype==PT_LAVA && parts[i].tmp>0 && parts[i].tmp<PT_NUM && sim->elements[parts[i].tmp].HighTemperatureTransition==PT_LAVA)
|
||||
parts[np].ctype = parts[i].tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@@ -67,14 +67,22 @@ int Element_CLNE::update(UPDATE_FUNC_ARGS)
|
||||
(r&0xFF)<PT_NUM)
|
||||
{
|
||||
parts[i].ctype = r&0xFF;
|
||||
if ((r&0xFF)==PT_LIFE)
|
||||
if ((r&0xFF)==PT_LIFE || (r&0xFF)==PT_LAVA)
|
||||
parts[i].tmp = parts[r>>8].ctype;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (parts[i].ctype==PT_LIFE) sim->create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype|(parts[i].tmp<<8));
|
||||
else sim->create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
|
||||
else
|
||||
{
|
||||
int np = sim->create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
|
||||
if (np>=0)
|
||||
{
|
||||
if (parts[i].ctype==PT_LAVA && parts[i].tmp>0 && parts[i].tmp<PT_NUM && sim->elements[parts[i].tmp].HighTemperatureTransition==PT_LAVA)
|
||||
parts[np].ctype = parts[i].tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@@ -82,7 +82,7 @@ int Element_PBCN::update(UPDATE_FUNC_ARGS)
|
||||
(r&0xFF)!=PT_PBCN && (r&0xFF)<PT_NUM)
|
||||
{
|
||||
parts[i].ctype = r&0xFF;
|
||||
if ((r&0xFF)==PT_LIFE)
|
||||
if ((r&0xFF)==PT_LIFE || (r&0xFF)==PT_LAVA)
|
||||
parts[i].tmp = parts[r>>8].ctype;
|
||||
}
|
||||
}
|
||||
@@ -135,8 +135,15 @@ int Element_PBCN::update(UPDATE_FUNC_ARGS)
|
||||
sim->create_part(-1, x+rx, y+ry, parts[i].ctype|(parts[i].tmp<<8));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sim->create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
|
||||
}
|
||||
else
|
||||
{
|
||||
int np = sim->create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
|
||||
if (np>=0)
|
||||
{
|
||||
if (parts[i].ctype==PT_LAVA && parts[i].tmp>0 && parts[i].tmp<PT_NUM && sim->elements[parts[i].tmp].HighTemperatureTransition==PT_LAVA)
|
||||
parts[np].ctype = parts[i].tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@@ -91,7 +91,7 @@ int Element_PCLN::update(UPDATE_FUNC_ARGS)
|
||||
(r&0xFF)!=PT_PBCN && (r&0xFF)<PT_NUM)
|
||||
{
|
||||
parts[i].ctype = r&0xFF;
|
||||
if ((r&0xFF)==PT_LIFE)
|
||||
if ((r&0xFF)==PT_LIFE || (r&0xFF)==PT_LAVA)
|
||||
parts[i].tmp = parts[r>>8].ctype;
|
||||
}
|
||||
}
|
||||
@@ -125,8 +125,15 @@ int Element_PCLN::update(UPDATE_FUNC_ARGS)
|
||||
sim->create_part(-1, x+rx, y+ry, parts[i].ctype|(parts[i].tmp<<8));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sim->create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
|
||||
}
|
||||
else
|
||||
{
|
||||
int np = sim->create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
|
||||
if (np>=0)
|
||||
{
|
||||
if (parts[i].ctype==PT_LAVA && parts[i].tmp>0 && parts[i].tmp<PT_NUM && sim->elements[parts[i].tmp].HighTemperatureTransition==PT_LAVA)
|
||||
parts[np].ctype = parts[i].tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user