STOR now automatically transfers to PRTI
This commit is contained in:
parent
37794c01af
commit
01afd69c17
@ -57,21 +57,24 @@ Element_PRTI::Element_PRTI()
|
|||||||
//#TPT-Directive ElementHeader Element_PRTI static int update(UPDATE_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_PRTI static int update(UPDATE_FUNC_ARGS)
|
||||||
int Element_PRTI::update(UPDATE_FUNC_ARGS)
|
int Element_PRTI::update(UPDATE_FUNC_ARGS)
|
||||||
{
|
{
|
||||||
int r, nnx, rx, ry, fe = 0;
|
int fe = 0;
|
||||||
int count =0;
|
|
||||||
parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
|
parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
|
||||||
if (parts[i].tmp>=CHANNELS) parts[i].tmp = CHANNELS-1;
|
if (parts[i].tmp >= CHANNELS)
|
||||||
else if (parts[i].tmp<0) parts[i].tmp = 0;
|
parts[i].tmp = CHANNELS-1;
|
||||||
for (count=0; count<8; count++)
|
else if (parts[i].tmp < 0)
|
||||||
|
parts[i].tmp = 0;
|
||||||
|
|
||||||
|
for (int count = 0; count < 8; count++)
|
||||||
{
|
{
|
||||||
rx = sim->portal_rx[count];
|
int rx = sim->portal_rx[count];
|
||||||
ry = sim->portal_ry[count];
|
int ry = sim->portal_ry[count];
|
||||||
if (BOUNDS_CHECK && (rx || ry))
|
if (BOUNDS_CHECK && (rx || ry))
|
||||||
{
|
{
|
||||||
r = pmap[y+ry][x+rx];
|
int r = pmap[y+ry][x+rx];
|
||||||
if (!r)
|
if (!r || (r&0xFF) == PT_STOR)
|
||||||
fe = 1;
|
fe = 1;
|
||||||
if (!r || (!(sim->elements[r&0xFF].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY)) && (r&0xFF)!=PT_SPRK))
|
if (!r || (!(sim->elements[r&0xFF].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY)) && (r&0xFF)!=PT_SPRK && (r&0xFF)!=PT_STOR))
|
||||||
{
|
{
|
||||||
r = sim->photons[y+ry][x+rx];
|
r = sim->photons[y+ry][x+rx];
|
||||||
if (!r)
|
if (!r)
|
||||||
@ -84,16 +87,28 @@ int Element_PRTI::update(UPDATE_FUNC_ARGS)
|
|||||||
if ((r&0xFF) == PT_SOAP)
|
if ((r&0xFF) == PT_SOAP)
|
||||||
Element_SOAP::detach(sim, r>>8);
|
Element_SOAP::detach(sim, r>>8);
|
||||||
|
|
||||||
for ( nnx=0; nnx<80; nnx++)
|
for (int nnx=0; nnx<80; nnx++)
|
||||||
if (!sim->portalp[parts[i].tmp][count][nnx].type)
|
if (!sim->portalp[parts[i].tmp][count][nnx].type)
|
||||||
{
|
{
|
||||||
sim->portalp[parts[i].tmp][count][nnx] = parts[r>>8];
|
if ((r&0xFF) == PT_STOR)
|
||||||
if ((r&0xFF)==PT_SPRK)
|
{
|
||||||
sim->part_change_type(r>>8,x+rx,y+ry,parts[r>>8].ctype);
|
if (sim->IsValidElement(parts[r>>8].tmp) && (sim->elements[parts[r>>8].tmp].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY)))
|
||||||
|
{
|
||||||
|
// STOR uses same format as PIPE, so we can use this function to do the transfer
|
||||||
|
Element_PIPE::transfer_pipe_to_part(sim, parts+(r>>8), &sim->portalp[parts[i].tmp][count][nnx]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sim->kill_part(r>>8);
|
{
|
||||||
fe = 1;
|
sim->portalp[parts[i].tmp][count][nnx] = parts[r>>8];
|
||||||
break;
|
if ((r&0xFF) == PT_SPRK)
|
||||||
|
sim->part_change_type(r>>8,x+rx,y+ry,parts[r>>8].ctype);
|
||||||
|
else
|
||||||
|
sim->kill_part(r>>8);
|
||||||
|
fe = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,7 +120,7 @@ int Element_PRTI::update(UPDATE_FUNC_ARGS)
|
|||||||
if (!sim->parts[i].life) parts[i].life = rand()*rand()*rand();
|
if (!sim->parts[i].life) parts[i].life = rand()*rand()*rand();
|
||||||
if (!sim->parts[i].ctype) parts[i].ctype = rand()*rand()*rand();
|
if (!sim->parts[i].ctype) parts[i].ctype = rand()*rand()*rand();
|
||||||
sim->orbitalparts_get(parts[i].life, parts[i].ctype, orbd, orbl);
|
sim->orbitalparts_get(parts[i].life, parts[i].ctype, orbd, orbl);
|
||||||
for (r = 0; r < 4; r++) {
|
for (int r = 0; r < 4; r++) {
|
||||||
if (orbd[r]>1) {
|
if (orbd[r]>1) {
|
||||||
orbd[r] -= 12;
|
orbd[r] -= 12;
|
||||||
if (orbd[r]<1) {
|
if (orbd[r]<1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user