Skip to content

Commit c7a10c7

Browse files
committed
Merge remote-tracking branch 'Rebmiami/paper' into playtest-june2025
2 parents 12c4070 + aa7cbbf commit c7a10c7

File tree

13 files changed

+395
-7
lines changed

13 files changed

+395
-7
lines changed

src/simulation/Simulation.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,14 @@ int Simulation::eval_move(int pt, int nx, int ny, unsigned *rr) const
11441144
return 0;
11451145
}
11461146
break;
1147+
case PT_PAPR:
1148+
// BCOL can always pass through PAPR in order to color it
1149+
// Most elements are blocked by marked PAPR, except for certified "weird" elements where it's inverse
1150+
if ((pt == PT_BCOL) || (!parts[ID(r)].life != !(pt != PT_H2 && pt != PT_ANAR && pt != PT_BIZR && pt != PT_BIZRG)))
1151+
result = 2;
1152+
else
1153+
result = 0;
1154+
break;
11471155
default:
11481156
// This should never happen
11491157
// If it were to happen, try_move would interpret a 3 as a 1
@@ -1192,8 +1200,8 @@ int Simulation::try_move(int i, int x, int y, int nx, int ny)
11921200
{
11931201
if (rt == PT_COAL || rt == PT_BCOL)
11941202
parts[ID(r)].temp = parts[i].temp;
1195-
1196-
if (rt < PT_NUM && !IsHeatInsulator(parts[ID(r)]) && rt != PT_FILT)
1203+
1204+
if (rt < PT_NUM && !IsHeatInsulator(parts[ID(r)]) && rt != PT_FILT && rt != PT_PAPR)
11971205
parts[i].temp = parts[ID(r)].temp = restrict_flt((parts[ID(r)].temp+parts[i].temp)/2, MIN_TEMP, MAX_TEMP);
11981206
}
11991207
else if ((parts[i].type==PT_NEUT || parts[i].type==PT_ELEC) && (rt==PT_CLNE || rt==PT_PCLN || rt==PT_BCLN || rt==PT_PBCN))
@@ -2390,7 +2398,8 @@ void Simulation::UpdateParticles(int start, int end)
23902398
|| (t == PT_ELEC && rt == PT_DEUT)
23912399
|| (t == PT_DEUT && rt == PT_ELEC)
23922400
|| (t == PT_HSWC && rt == PT_FILT && parts[i].tmp == 1)
2393-
|| (t == PT_FILT && rt == PT_HSWC && parts[ID(r)].tmp == 1))
2401+
|| (t == PT_FILT && rt == PT_HSWC && parts[ID(r)].tmp == 1)
2402+
|| (t == PT_PHOT && rt == PT_PAPR))
23942403
continue;
23952404

23962405
surround_hconduct[j] = ID(r);
@@ -3270,9 +3279,9 @@ void Simulation::RecalcFreeParticles(bool do_life_dec)
32703279
photons[y][x] = PMAP(i, t);
32713280
else
32723281
{
3273-
// Particles are sometimes allowed to go inside INVS and FILT
3282+
// Particles are sometimes allowed to go inside INVS, FILT, and PAPR
32743283
// To make particles collide correctly when inside these elements, these elements must not overwrite an existing pmap entry from particles inside them
3275-
if (!pmap[y][x] || (t!=PT_INVIS && t!= PT_FILT))
3284+
if (!pmap[y][x] || (t!=PT_INVIS && t!= PT_FILT && t != PT_PAPR))
32763285
pmap[y][x] = PMAP(i, t);
32773286
// (there are a few exceptions, including energy particles - currently no limit on stacking those)
32783287
if (t!=PT_THDR && t!=PT_EMBR && t!=PT_FIGH && t!=PT_PLSM)

src/simulation/SimulationData.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ void SimulationData::init_can_move()
182182
//SAWD cannot be displaced by other powders
183183
if (elements[movingType].Properties & TYPE_PART)
184184
can_move[movingType][PT_SAWD] = 0;
185+
186+
// Let most elements pass through unmarked PAPR
187+
if (movingType != PT_FIRE && movingType != PT_SAWD)
188+
can_move[movingType][PT_PAPR] = 3;
185189
}
186190

187191
for (destinationType = 0; destinationType < PT_NUM; destinationType++)
@@ -211,6 +215,7 @@ void SimulationData::init_can_move()
211215
can_move[PT_ELEC][PT_EXOT] = 2;
212216
can_move[PT_ELEC][PT_GLOW] = 2;
213217
can_move[PT_PHOT][PT_LCRY] = 3; //varies according to LCRY life
218+
can_move[PT_PHOT][PT_PAPR] = 3; //varies according to PAPR life
214219
can_move[PT_PHOT][PT_GPMP] = 3;
215220

216221
can_move[PT_PHOT][PT_BIZR] = 2;
@@ -230,6 +235,9 @@ void SimulationData::init_can_move()
230235
can_move[PT_TRON][PT_SWCH] = 3;
231236
can_move[PT_ELEC][PT_RSST] = 2;
232237
can_move[PT_ELEC][PT_RSSS] = 2;
238+
239+
can_move[PT_MWAX][PT_SAWD] = 0;
240+
can_move[PT_SAWD][PT_MWAX] = 0;
233241
}
234242

235243
const CustomGOLData *SimulationData::GetCustomGOLByRule(int rule) const

src/simulation/elements/ACID.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,19 @@ static int update(UPDATE_FUNC_ARGS)
9898
sim->part_change_type(ID(r), x + rx, y + ry, PT_H2);
9999
break;
100100

101+
case PT_PAPR:
102+
if (sim->rng.chance(1, 2))
103+
{
104+
sim->create_part(ID(r), x + rx, y + ry, PT_COAL);
105+
parts[ID(r)].tmp = sim->rng.between(1, 39);
106+
}
107+
else
108+
{
109+
sim->create_part(ID(r), x + rx, y + ry, PT_WTRV);
110+
parts[ID(r)].temp = parts[i].temp;
111+
}
112+
break;
113+
101114
default:
102115
sim->kill_part(ID(r));
103116
break;

src/simulation/elements/ARAY.cpp

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,32 @@ static int update(UPDATE_FUNC_ARGS)
165165
{
166166
parts[r].life = 10;
167167
}
168+
}
169+
else if (rt == PT_PAPR)
170+
{
171+
// In reading/writing state?
172+
if (parts[r].tmp)
173+
{
174+
if (parts[r].tmp & 0x10) // Reading state
175+
{
176+
// End reading state early
177+
parts[r].tmp = 0;
178+
if (parts[r].life)
179+
{
180+
break;
181+
}
182+
}
183+
else // Writing state
184+
{
185+
parts[r].life = 1;
186+
parts[r].dcolour = 0xFF1A2222;
187+
}
188+
}
189+
else
190+
{
191+
// Enter writing state
192+
parts[r].tmp = 0x03;
193+
}
168194
// this if prevents BRAY from stopping on certain materials
169195
}
170196
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))
@@ -189,7 +215,7 @@ static int update(UPDATE_FUNC_ARGS)
189215
parts[r].dcolour = 0xFF000000;
190216
//this if prevents red BRAY from stopping on certain materials
191217
}
192-
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))
218+
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) || rt==PT_PAPR)
193219
{
194220
if (rt == PT_STOR)
195221
{
@@ -201,6 +227,32 @@ static int update(UPDATE_FUNC_ARGS)
201227
isBlackDeco = (parts[r].dcolour==0xFF000000);
202228
parts[r].life = 2;
203229
}
230+
else if (rt == PT_PAPR)
231+
{
232+
// In reading/writing state?
233+
if (parts[r].tmp)
234+
{
235+
if (parts[r].tmp & 0x10) // Reading state
236+
{
237+
// End reading state early
238+
parts[r].tmp = 0;
239+
if (parts[r].life)
240+
{
241+
break;
242+
}
243+
}
244+
else // Writing state
245+
{
246+
parts[r].life = 0;
247+
parts[r].dcolour = 0;
248+
}
249+
}
250+
else
251+
{
252+
// Enter reading state
253+
parts[r].tmp = 0x13;
254+
}
255+
}
204256
docontinue = 1;
205257
}
206258
else

src/simulation/elements/CRAY.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "simulation/ElementCommon.h"
22
#include "FILT.h"
3+
#include "PAPR.h"
34

45
static int update(UPDATE_FUNC_ARGS);
56
static bool ctypeDraw(CTYPEDRAW_FUNC_ARGS);
@@ -122,6 +123,21 @@ static int update(UPDATE_FUNC_ARGS)
122123
else if (colored==0xFF000000)
123124
colored = 0;
124125
parts[ID(r)].life = 4;
126+
} else if (TYP(r) == PT_PAPR) {
127+
if (TYP(parts[i].ctype == PT_COAL) || TYP(parts[i].ctype) == PT_BCOL) {
128+
sim->parts[ID(r)].life = 1;
129+
if (colored)
130+
sim->parts[ID(r)].dcolour = colored;
131+
else
132+
sim->parts[ID(r)].dcolour = MARK_COLOR_COAL;
133+
if(!--partsRemaining)
134+
docontinue = 0;
135+
} else if (TYP(parts[i].ctype == PT_SOAP)) {
136+
sim->parts[ID(r)].life = 0;
137+
sim->parts[ID(r)].dcolour = 0x00000000;
138+
if(!--partsRemaining)
139+
docontinue = 0;
140+
}
125141
} else if (TYP(r) == PT_CRAY || nostop) {
126142
docontinue = 1;
127143
} else if(destroy && r && (TYP(r) != PT_DMND)) {

src/simulation/elements/ELEC.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ static int update(UPDATE_FUNC_ARGS)
126126
return 1;
127127
}
128128
break;
129+
case PT_PAPR:
130+
if (sim->rng.chance(1, 20))
131+
{
132+
int dcolour = parts[ID(r)].dcolour;
133+
sim->create_part(ID(r), x+rx, y+ry, PT_LCRY);
134+
parts[ID(r)].dcolour = dcolour;
135+
}
136+
break;
129137
case PT_NONE: //seems to speed up ELEC even if it isn't used
130138
break;
131139
default:

src/simulation/elements/FIRE.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,11 @@ int Element_FIRE_update(UPDATE_FUNC_ARGS)
197197
}
198198
}
199199
}
200+
// Make paper burn more reliably
201+
if (rt == PT_PAPR && t != PT_PHOT)
202+
{
203+
parts[ID(r)].temp += 4;
204+
}
200205

201206
if (t == PT_LAVA)
202207
{

src/simulation/elements/NEUT.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,11 @@ static int update(UPDATE_FUNC_ARGS)
194194
case PT_BASE:
195195
if (parts[ID(r)].temp > (50 + 273.15) && sim->rng.chance(1, 35))
196196
sim->create_part(ID(r), x+rx, y+ry, PT_LRBD);
197+
case PT_PAPR:
198+
if (sim->rng.chance(1, 20))
199+
{
200+
sim->create_part(ID(r), x+rx, y+ry, PT_INVIS);
201+
}
197202
break;
198203
default:
199204
break;

0 commit comments

Comments
 (0)