Remove leftover cooldown-related code from ARAY and DRAY
This commit is contained in:
parent
41254a2f95
commit
94353a9a3b
@ -31,7 +31,7 @@ void Element::Element_ARAY()
|
|||||||
HeatConduct = 0;
|
HeatConduct = 0;
|
||||||
Description = "Ray Emitter. Rays create points when they collide.";
|
Description = "Ray Emitter. Rays create points when they collide.";
|
||||||
|
|
||||||
Properties = TYPE_SOLID|PROP_LIFE_DEC;
|
Properties = TYPE_SOLID;
|
||||||
|
|
||||||
LowPressure = IPL;
|
LowPressure = IPL;
|
||||||
LowPressureTransition = NT;
|
LowPressureTransition = NT;
|
||||||
@ -47,164 +47,165 @@ void Element::Element_ARAY()
|
|||||||
|
|
||||||
static int update(UPDATE_FUNC_ARGS)
|
static int update(UPDATE_FUNC_ARGS)
|
||||||
{
|
{
|
||||||
if (!parts[i].life)
|
for (int rx = -1; rx <= 1; rx++)
|
||||||
{
|
{
|
||||||
for (int rx = -1; rx <= 1; rx++)
|
for (int ry = -1; ry <= 1; ry++)
|
||||||
for (int ry = -1; ry <= 1; ry++)
|
{
|
||||||
if (BOUNDS_CHECK && (rx || ry))
|
if (BOUNDS_CHECK && (rx || ry))
|
||||||
|
{
|
||||||
|
int r = pmap[y+ry][x+rx];
|
||||||
|
if (!r)
|
||||||
|
continue;
|
||||||
|
if (TYP(r) == PT_SPRK && parts[ID(r)].life == 3)
|
||||||
{
|
{
|
||||||
int r = pmap[y+ry][x+rx];
|
bool isBlackDeco = false;
|
||||||
if (!r)
|
int destroy = (parts[ID(r)].ctype==PT_PSCN) ? 1 : 0;
|
||||||
continue;
|
int nostop = (parts[ID(r)].ctype==PT_INST) ? 1 : 0;
|
||||||
if (TYP(r) == PT_SPRK && parts[ID(r)].life == 3)
|
int colored = 0, rt;
|
||||||
|
for (int docontinue = 1, nxx = 0, nyy = 0, nxi = rx*-1, nyi = ry*-1; docontinue; nyy+=nyi, nxx+=nxi)
|
||||||
{
|
{
|
||||||
bool isBlackDeco = false;
|
if (!(x+nxi+nxx<XRES && y+nyi+nyy<YRES && x+nxi+nxx >= 0 && y+nyi+nyy >= 0))
|
||||||
int destroy = (parts[ID(r)].ctype==PT_PSCN) ? 1 : 0;
|
break;
|
||||||
int nostop = (parts[ID(r)].ctype==PT_INST) ? 1 : 0;
|
|
||||||
int colored = 0, rt;
|
|
||||||
for (int docontinue = 1, nxx = 0, nyy = 0, nxi = rx*-1, nyi = ry*-1; docontinue; nyy+=nyi, nxx+=nxi)
|
|
||||||
{
|
|
||||||
if (!(x+nxi+nxx<XRES && y+nyi+nyy<YRES && x+nxi+nxx >= 0 && y+nyi+nyy >= 0))
|
|
||||||
break;
|
|
||||||
|
|
||||||
r = pmap[y+nyi+nyy][x+nxi+nxx];
|
r = pmap[y+nyi+nyy][x+nxi+nxx];
|
||||||
rt = TYP(r);
|
rt = TYP(r);
|
||||||
r = ID(r);
|
r = ID(r);
|
||||||
if (!rt)
|
if (!rt)
|
||||||
|
{
|
||||||
|
int nr = sim->create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_BRAY);
|
||||||
|
if (nr != -1)
|
||||||
{
|
{
|
||||||
int nr = sim->create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_BRAY);
|
// if it came from PSCN
|
||||||
if (nr != -1)
|
if (destroy)
|
||||||
{
|
{
|
||||||
// if it came from PSCN
|
parts[nr].tmp = 2;
|
||||||
if (destroy)
|
parts[nr].life = 2;
|
||||||
{
|
|
||||||
parts[nr].tmp = 2;
|
|
||||||
parts[nr].life = 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
parts[nr].ctype = colored;
|
|
||||||
parts[nr].temp = parts[i].temp;
|
|
||||||
if (isBlackDeco)
|
|
||||||
parts[nr].dcolour = 0xFF000000;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
parts[nr].ctype = colored;
|
||||||
|
parts[nr].temp = parts[i].temp;
|
||||||
|
if (isBlackDeco)
|
||||||
|
parts[nr].dcolour = 0xFF000000;
|
||||||
}
|
}
|
||||||
else if (!destroy)
|
}
|
||||||
|
else if (!destroy)
|
||||||
|
{
|
||||||
|
if (rt == PT_BRAY)
|
||||||
{
|
{
|
||||||
if (rt == PT_BRAY)
|
// cases for hitting different BRAY modes
|
||||||
|
switch(parts[r].tmp)
|
||||||
{
|
{
|
||||||
// cases for hitting different BRAY modes
|
// normal white
|
||||||
switch(parts[r].tmp)
|
case 0:
|
||||||
|
if (nyy != 0 || nxx !=0)
|
||||||
{
|
{
|
||||||
// normal white
|
parts[r].life = 1020; // makes it last a while
|
||||||
case 0:
|
parts[r].tmp = 1;
|
||||||
if (nyy != 0 || nxx !=0)
|
if (!parts[r].ctype) // and colors it if it isn't already
|
||||||
{
|
parts[r].ctype = colored;
|
||||||
parts[r].life = 1020; // makes it last a while
|
|
||||||
parts[r].tmp = 1;
|
|
||||||
if (!parts[r].ctype) // and colors it if it isn't already
|
|
||||||
parts[r].ctype = colored;
|
|
||||||
}
|
|
||||||
// red bray or any other random tmp mode, stop
|
|
||||||
case 2:
|
|
||||||
default:
|
|
||||||
docontinue = 0;
|
|
||||||
break;
|
|
||||||
// long life, reset it
|
|
||||||
case 1:
|
|
||||||
parts[r].life = 1020;
|
|
||||||
//docontinue = 1;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (isBlackDeco)
|
// red bray or any other random tmp mode, stop
|
||||||
parts[r].dcolour = 0xFF000000;
|
case 2:
|
||||||
|
default:
|
||||||
|
docontinue = 0;
|
||||||
|
break;
|
||||||
|
// long life, reset it
|
||||||
|
case 1:
|
||||||
|
parts[r].life = 1020;
|
||||||
|
//docontinue = 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
// get color if passed through FILT
|
if (isBlackDeco)
|
||||||
else if (rt == PT_FILT)
|
parts[r].dcolour = 0xFF000000;
|
||||||
|
}
|
||||||
|
// get color if passed through FILT
|
||||||
|
else if (rt == PT_FILT)
|
||||||
|
{
|
||||||
|
if (parts[r].tmp != 6)
|
||||||
{
|
{
|
||||||
if (parts[r].tmp != 6)
|
int Element_FILT_interactWavelengths(Particle* cpart, int origWl);
|
||||||
{
|
colored = Element_FILT_interactWavelengths(&parts[r], colored);
|
||||||
int Element_FILT_interactWavelengths(Particle* cpart, int origWl);
|
if (!colored)
|
||||||
colored = Element_FILT_interactWavelengths(&parts[r], colored);
|
break;
|
||||||
if (!colored)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
isBlackDeco = (parts[r].dcolour==0xFF000000);
|
|
||||||
parts[r].life = 4;
|
|
||||||
}
|
}
|
||||||
else if (rt == PT_STOR)
|
isBlackDeco = (parts[r].dcolour==0xFF000000);
|
||||||
|
parts[r].life = 4;
|
||||||
|
}
|
||||||
|
else if (rt == PT_STOR)
|
||||||
|
{
|
||||||
|
if (parts[r].tmp)
|
||||||
{
|
{
|
||||||
if (parts[r].tmp)
|
//Cause STOR to release
|
||||||
|
for (int ry1 = 1; ry1 >= -1; ry1--)
|
||||||
{
|
{
|
||||||
//Cause STOR to release
|
for (int rx1 = 0; rx1 >= -1 && rx1 <= 1; rx1 = -rx1 - rx1 + 1)
|
||||||
for (int ry1 = 1; ry1 >= -1; ry1--)
|
|
||||||
{
|
{
|
||||||
for (int rx1 = 0; rx1 >= -1 && rx1 <= 1; rx1 = -rx1 - rx1 + 1)
|
int np = sim->create_part(-1, x + nxi + nxx + rx1, y + nyi + nyy + ry1, TYP(parts[r].tmp));
|
||||||
|
if (np != -1)
|
||||||
{
|
{
|
||||||
int np = sim->create_part(-1, x + nxi + nxx + rx1, y + nyi + nyy + ry1, TYP(parts[r].tmp));
|
parts[np].temp = parts[r].temp;
|
||||||
if (np != -1)
|
parts[np].life = parts[r].tmp2;
|
||||||
{
|
parts[np].tmp = parts[r].pavg[0];
|
||||||
parts[np].temp = parts[r].temp;
|
parts[np].ctype = parts[r].pavg[1];
|
||||||
parts[np].life = parts[r].tmp2;
|
parts[r].tmp = 0;
|
||||||
parts[np].tmp = parts[r].pavg[0];
|
parts[r].life = 10;
|
||||||
parts[np].ctype = parts[r].pavg[1];
|
break;
|
||||||
parts[r].tmp = 0;
|
|
||||||
parts[r].life = 10;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
parts[r].life = 10;
|
|
||||||
}
|
|
||||||
// this if prevents BRAY from stopping on certain materials
|
|
||||||
}
|
|
||||||
else if (rt != PT_INWR && (rt != PT_SPRK || parts[r].ctype != PT_INWR) && rt != PT_ARAY && rt != PT_WIFI && !(rt == PT_SWCH && parts[r].life >= 10))
|
|
||||||
{
|
|
||||||
if (nyy!=0 || nxx!=0)
|
|
||||||
sim->create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK);
|
|
||||||
|
|
||||||
if (!(nostop && parts[r].type==PT_SPRK && parts[r].ctype >= 0 && parts[r].ctype < PT_NUM && (sim->elements[parts[r].ctype].Properties&PROP_CONDUCTS)))
|
|
||||||
docontinue = 0;
|
|
||||||
else
|
|
||||||
docontinue = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (destroy)
|
|
||||||
{
|
|
||||||
if (rt == PT_BRAY)
|
|
||||||
{
|
|
||||||
parts[r].tmp = 2;
|
|
||||||
parts[r].life = 1;
|
|
||||||
docontinue = 1;
|
|
||||||
if (isBlackDeco)
|
|
||||||
parts[r].dcolour = 0xFF000000;
|
|
||||||
//this if prevents red BRAY from stopping on certain materials
|
|
||||||
}
|
|
||||||
else if (rt==PT_STOR || rt==PT_INWR || (rt==PT_SPRK && parts[r].ctype==PT_INWR) || rt==PT_ARAY || rt==PT_WIFI || rt==PT_FILT || (rt==PT_SWCH && parts[r].life>=10))
|
|
||||||
{
|
|
||||||
if (rt == PT_STOR)
|
|
||||||
{
|
|
||||||
parts[r].tmp = 0;
|
|
||||||
parts[r].life = 0;
|
|
||||||
}
|
|
||||||
else if (rt == PT_FILT)
|
|
||||||
{
|
|
||||||
isBlackDeco = (parts[r].dcolour==0xFF000000);
|
|
||||||
parts[r].life = 2;
|
|
||||||
}
|
|
||||||
docontinue = 1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
docontinue = 0;
|
parts[r].life = 10;
|
||||||
}
|
}
|
||||||
|
// this if prevents BRAY from stopping on certain materials
|
||||||
|
}
|
||||||
|
else if (rt != PT_INWR && (rt != PT_SPRK || parts[r].ctype != PT_INWR) && rt != PT_ARAY && rt != PT_WIFI && !(rt == PT_SWCH && parts[r].life >= 10))
|
||||||
|
{
|
||||||
|
if (nyy!=0 || nxx!=0)
|
||||||
|
sim->create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK);
|
||||||
|
|
||||||
|
if (!(nostop && parts[r].type==PT_SPRK && parts[r].ctype >= 0 && parts[r].ctype < PT_NUM && (sim->elements[parts[r].ctype].Properties&PROP_CONDUCTS)))
|
||||||
|
docontinue = 0;
|
||||||
|
else
|
||||||
|
docontinue = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (destroy)
|
||||||
|
{
|
||||||
|
if (rt == PT_BRAY)
|
||||||
|
{
|
||||||
|
parts[r].tmp = 2;
|
||||||
|
parts[r].life = 1;
|
||||||
|
docontinue = 1;
|
||||||
|
if (isBlackDeco)
|
||||||
|
parts[r].dcolour = 0xFF000000;
|
||||||
|
//this if prevents red BRAY from stopping on certain materials
|
||||||
|
}
|
||||||
|
else if (rt==PT_STOR || rt==PT_INWR || (rt==PT_SPRK && parts[r].ctype==PT_INWR) || rt==PT_ARAY || rt==PT_WIFI || rt==PT_FILT || (rt==PT_SWCH && parts[r].life>=10))
|
||||||
|
{
|
||||||
|
if (rt == PT_STOR)
|
||||||
|
{
|
||||||
|
parts[r].tmp = 0;
|
||||||
|
parts[r].life = 0;
|
||||||
|
}
|
||||||
|
else if (rt == PT_FILT)
|
||||||
|
{
|
||||||
|
isBlackDeco = (parts[r].dcolour==0xFF000000);
|
||||||
|
parts[r].life = 2;
|
||||||
|
}
|
||||||
|
docontinue = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
docontinue = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//parts[i].life = 4;
|
|
||||||
}
|
}
|
||||||
|
//parts[i].life = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ void Element::Element_DRAY()
|
|||||||
HeatConduct = 0;
|
HeatConduct = 0;
|
||||||
Description = "Duplicator ray. Replicates a line of particles in front of it.";
|
Description = "Duplicator ray. Replicates a line of particles in front of it.";
|
||||||
|
|
||||||
Properties = TYPE_SOLID | PROP_LIFE_DEC;
|
Properties = TYPE_SOLID;
|
||||||
|
|
||||||
LowPressure = IPL;
|
LowPressure = IPL;
|
||||||
LowPressureTransition = NT;
|
LowPressureTransition = NT;
|
||||||
@ -62,111 +62,113 @@ static int update(UPDATE_FUNC_ARGS)
|
|||||||
copyLength = parts[i].tmp = 0;
|
copyLength = parts[i].tmp = 0;
|
||||||
else if (copyLength > 0)
|
else if (copyLength > 0)
|
||||||
copySpaces++; //strange hack
|
copySpaces++; //strange hack
|
||||||
if (!parts[i].life) // only fire when life is 0, but nothing sets the life right now
|
|
||||||
|
for (int rx = -1; rx <= 1; rx++)
|
||||||
{
|
{
|
||||||
for (int rx = -1; rx <= 1; rx++)
|
for (int ry = -1; ry <= 1; ry++)
|
||||||
for (int ry = -1; ry <= 1; ry++)
|
{
|
||||||
if (BOUNDS_CHECK && (rx || ry))
|
if (BOUNDS_CHECK && (rx || ry))
|
||||||
|
{
|
||||||
|
int r = pmap[y+ry][x+rx];
|
||||||
|
if (TYP(r) == PT_SPRK && parts[ID(r)].life == 3) //spark found, start creating
|
||||||
{
|
{
|
||||||
int r = pmap[y+ry][x+rx];
|
bool overwrite = parts[ID(r)].ctype == PT_PSCN;
|
||||||
if (TYP(r) == PT_SPRK && parts[ID(r)].life == 3) //spark found, start creating
|
int partsRemaining = copyLength, xCopyTo = -1, yCopyTo = -1; //positions where the line will start being copied at
|
||||||
|
int localCopyLength = copyLength;
|
||||||
|
|
||||||
|
if (parts[ID(r)].ctype == PT_INWR && rx && ry) // INWR doesn't spark from diagonals
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//figure out where the copying will start/end
|
||||||
|
bool foundParticle = false;
|
||||||
|
bool isEnergy = false;
|
||||||
|
for (int xStep = rx*-1, yStep = ry*-1, xCurrent = x+xStep, yCurrent = y+yStep; ; xCurrent+=xStep, yCurrent+=yStep)
|
||||||
{
|
{
|
||||||
bool overwrite = parts[ID(r)].ctype == PT_PSCN;
|
// Out of bounds, stop looking and don't copy anything
|
||||||
int partsRemaining = copyLength, xCopyTo = -1, yCopyTo = -1; //positions where the line will start being copied at
|
if (!sim->InBounds(xCurrent, yCurrent))
|
||||||
int localCopyLength = copyLength;
|
break;
|
||||||
|
int rr;
|
||||||
if (parts[ID(r)].ctype == PT_INWR && rx && ry) // INWR doesn't spark from diagonals
|
// haven't found a particle yet, keep looking for one
|
||||||
continue;
|
// the first particle it sees decides whether it will copy energy particles or not
|
||||||
|
if (!foundParticle)
|
||||||
//figure out where the copying will start/end
|
|
||||||
bool foundParticle = false;
|
|
||||||
bool isEnergy = false;
|
|
||||||
for (int xStep = rx*-1, yStep = ry*-1, xCurrent = x+xStep, yCurrent = y+yStep; ; xCurrent+=xStep, yCurrent+=yStep)
|
|
||||||
{
|
{
|
||||||
// Out of bounds, stop looking and don't copy anything
|
rr = pmap[yCurrent][xCurrent];
|
||||||
if (!sim->InBounds(xCurrent, yCurrent))
|
if (!rr)
|
||||||
break;
|
|
||||||
int rr;
|
|
||||||
// haven't found a particle yet, keep looking for one
|
|
||||||
// the first particle it sees decides whether it will copy energy particles or not
|
|
||||||
if (!foundParticle)
|
|
||||||
{
|
{
|
||||||
rr = pmap[yCurrent][xCurrent];
|
|
||||||
if (!rr)
|
|
||||||
{
|
|
||||||
rr = sim->photons[yCurrent][xCurrent];
|
|
||||||
if (rr)
|
|
||||||
foundParticle = isEnergy = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
foundParticle = true;
|
|
||||||
}
|
|
||||||
// now that it knows what kind of particle it is copying, do some extra stuff here so we can determine when to stop
|
|
||||||
if ((ctype && sim->elements[ctype].Properties&TYPE_ENERGY) || isEnergy)
|
|
||||||
rr = sim->photons[yCurrent][xCurrent];
|
rr = sim->photons[yCurrent][xCurrent];
|
||||||
|
if (rr)
|
||||||
|
foundParticle = isEnergy = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
rr = pmap[yCurrent][xCurrent];
|
foundParticle = true;
|
||||||
|
}
|
||||||
|
// now that it knows what kind of particle it is copying, do some extra stuff here so we can determine when to stop
|
||||||
|
if ((ctype && sim->elements[ctype].Properties&TYPE_ENERGY) || isEnergy)
|
||||||
|
rr = sim->photons[yCurrent][xCurrent];
|
||||||
|
else
|
||||||
|
rr = pmap[yCurrent][xCurrent];
|
||||||
|
|
||||||
// Checks for when to stop:
|
// Checks for when to stop:
|
||||||
// 1: if .tmp isn't set, and the element in this spot is the ctype, then stop
|
// 1: if .tmp isn't set, and the element in this spot is the ctype, then stop
|
||||||
// 2: if .tmp is set, stop when the length limit reaches 0
|
// 2: if .tmp is set, stop when the length limit reaches 0
|
||||||
if ((!localCopyLength && TYP(rr) == ctype && (ctype != PT_LIFE || parts[ID(rr)].ctype == ctypeExtra))
|
if ((!localCopyLength && TYP(rr) == ctype && (ctype != PT_LIFE || parts[ID(rr)].ctype == ctypeExtra))
|
||||||
|| !--partsRemaining)
|
|| !--partsRemaining)
|
||||||
|
{
|
||||||
|
localCopyLength -= partsRemaining;
|
||||||
|
xCopyTo = xCurrent + xStep*copySpaces;
|
||||||
|
yCopyTo = yCurrent + yStep*copySpaces;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// now, actually copy the particles
|
||||||
|
partsRemaining = localCopyLength + 1;
|
||||||
|
int type, p;
|
||||||
|
for (int xStep = rx*-1, yStep = ry*-1, xCurrent = x+xStep, yCurrent = y+yStep; InBounds(xCopyTo, yCopyTo) && --partsRemaining; xCurrent+=xStep, yCurrent+=yStep, xCopyTo+=xStep, yCopyTo+=yStep)
|
||||||
|
{
|
||||||
|
// get particle to copy
|
||||||
|
if (isEnergy)
|
||||||
|
type = TYP(sim->photons[yCurrent][xCurrent]);
|
||||||
|
else
|
||||||
|
type = TYP(pmap[yCurrent][xCurrent]);
|
||||||
|
|
||||||
|
// if sparked by PSCN, overwrite whatever is in the target location, instead of just ignoring it
|
||||||
|
if (overwrite)
|
||||||
|
{
|
||||||
|
if (isEnergy)
|
||||||
{
|
{
|
||||||
localCopyLength -= partsRemaining;
|
if (sim->photons[yCopyTo][xCopyTo])
|
||||||
xCopyTo = xCurrent + xStep*copySpaces;
|
sim->kill_part(ID(sim->photons[yCopyTo][xCopyTo]));
|
||||||
yCopyTo = yCurrent + yStep*copySpaces;
|
}
|
||||||
break;
|
else
|
||||||
|
{
|
||||||
|
if (pmap[yCopyTo][xCopyTo])
|
||||||
|
sim->kill_part(ID(pmap[yCopyTo][xCopyTo]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (type == PT_SPRK) // spark hack
|
||||||
|
p = sim->create_part(-1, xCopyTo, yCopyTo, PT_METL);
|
||||||
|
else if (type)
|
||||||
|
p = sim->create_part(-1, xCopyTo, yCopyTo, type);
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
|
||||||
// now, actually copy the particles
|
// if new particle was created successfully
|
||||||
partsRemaining = localCopyLength + 1;
|
if (p >= 0)
|
||||||
int type, p;
|
|
||||||
for (int xStep = rx*-1, yStep = ry*-1, xCurrent = x+xStep, yCurrent = y+yStep; InBounds(xCopyTo, yCopyTo) && --partsRemaining; xCurrent+=xStep, yCurrent+=yStep, xCopyTo+=xStep, yCopyTo+=yStep)
|
|
||||||
{
|
{
|
||||||
// get particle to copy
|
|
||||||
if (isEnergy)
|
|
||||||
type = TYP(sim->photons[yCurrent][xCurrent]);
|
|
||||||
else
|
|
||||||
type = TYP(pmap[yCurrent][xCurrent]);
|
|
||||||
|
|
||||||
// if sparked by PSCN, overwrite whatever is in the target location, instead of just ignoring it
|
|
||||||
if (overwrite)
|
|
||||||
{
|
|
||||||
if (isEnergy)
|
|
||||||
{
|
|
||||||
if (sim->photons[yCopyTo][xCopyTo])
|
|
||||||
sim->kill_part(ID(sim->photons[yCopyTo][xCopyTo]));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (pmap[yCopyTo][xCopyTo])
|
|
||||||
sim->kill_part(ID(pmap[yCopyTo][xCopyTo]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type == PT_SPRK) // spark hack
|
if (type == PT_SPRK) // spark hack
|
||||||
p = sim->create_part(-1, xCopyTo, yCopyTo, PT_METL);
|
sim->part_change_type(p, xCopyTo, yCopyTo, PT_SPRK);
|
||||||
else if (type)
|
if (isEnergy)
|
||||||
p = sim->create_part(-1, xCopyTo, yCopyTo, type);
|
parts[p] = parts[ID(sim->photons[yCurrent][xCurrent])];
|
||||||
else
|
else
|
||||||
continue;
|
parts[p] = parts[ID(pmap[yCurrent][xCurrent])];
|
||||||
|
parts[p].x = xCopyTo;
|
||||||
// if new particle was created successfully
|
parts[p].y = yCopyTo;
|
||||||
if (p >= 0)
|
|
||||||
{
|
|
||||||
if (type == PT_SPRK) // spark hack
|
|
||||||
sim->part_change_type(p, xCopyTo, yCopyTo, PT_SPRK);
|
|
||||||
if (isEnergy)
|
|
||||||
parts[p] = parts[ID(sim->photons[yCurrent][xCurrent])];
|
|
||||||
else
|
|
||||||
parts[p] = parts[ID(pmap[yCurrent][xCurrent])];
|
|
||||||
parts[p].x = xCopyTo;
|
|
||||||
parts[p].y = yCopyTo;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user