DLAY element

This commit is contained in:
tridiaq 2011-07-26 19:08:35 +04:00 committed by Simon Robertshaw
parent e7907f9ea3
commit 7338545ab4
3 changed files with 26 additions and 10 deletions

View File

@ -131,7 +131,8 @@
#define PT_IRON 76 #define PT_IRON 76
#define PT_MORT 77 #define PT_MORT 77
#define PT_LIFE 78 #define PT_LIFE 78
#define PT_DLAY 79
// 80 - 89 Free
#define PT_SPNG 90 #define PT_SPNG 90
#define PT_RIME 91 #define PT_RIME 91
#define PT_FOG 92 #define PT_FOG 92
@ -207,9 +208,8 @@
#define ST_SOLID 1 #define ST_SOLID 1
#define ST_LIQUID 2 #define ST_LIQUID 2
#define ST_GAS 3 #define ST_GAS 3
/*
TODO: We should start to implement these.
*/
#define TYPE_PART 0x0001 //1 Powders #define TYPE_PART 0x0001 //1 Powders
#define TYPE_LIQUID 0x0002 //2 Liquids #define TYPE_LIQUID 0x0002 //2 Liquids
#define TYPE_SOLID 0x0004 //4 Solids #define TYPE_SOLID 0x0004 //4 Solids
@ -464,7 +464,7 @@ static const part_type ptypes[PT_NUM] =
{"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrolysis of WATR", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS|PROP_LIFE_DEC|PROP_HOT_GLOW, &update_IRON}, {"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrolysis of WATR", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS|PROP_LIFE_DEC|PROP_HOT_GLOW, &update_IRON},
{"MORT", PIXPACK(0xE0E0E0), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, 1, -1, SC_CRACKER2, R_TEMP+4.0f +273.15f, 60, "Steam Train.", ST_NONE, TYPE_PART, &update_MORT}, {"MORT", PIXPACK(0xE0E0E0), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, 1, -1, SC_CRACKER2, R_TEMP+4.0f +273.15f, 60, "Steam Train.", ST_NONE, TYPE_PART, &update_MORT},
{"LIFE", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Game Of Life! B3/S23", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL}, {"LIFE", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Game Of Life! B3/S23", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
/*FREE*/{"HLIF", PIXPACK(0xFF0000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 0, 100, SC_LIFE, 9000.0f, 40, "High Life! B36/S23", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL}, {"DLAY", PIXPACK(0x753590), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 1, 100, SC_ELEC, 4.0f+273.15f, 0, "Conducts with temperature-dependent delay. (use HEAT/COOL).", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS|PROP_LIFE_DEC, NULL},
/*FREE*/{"ASIM", PIXPACK(0x0000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 0, 100, SC_LIFE, 9000.0f, 40, "Assimilation! B345/S4567", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL}, /*FREE*/{"ASIM", PIXPACK(0x0000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 0, 100, SC_LIFE, 9000.0f, 40, "Assimilation! B345/S4567", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
/*FREE*/{"2x2", PIXPACK(0xFFFF00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 0, 100, SC_LIFE, 9000.0f, 40, "2x2! B36/S125", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL}, /*FREE*/{"2x2", PIXPACK(0xFFFF00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 0, 100, SC_LIFE, 9000.0f, 40, "2x2! B36/S125", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
/*FREE*/{"DANI", PIXPACK(0x00FFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 0, 100, SC_LIFE, 9000.0f, 40, "Day and Night! B3678/S34678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL}, /*FREE*/{"DANI", PIXPACK(0x00FFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 0, 100, SC_LIFE, 9000.0f, 40, "Day and Night! B3678/S34678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
@ -712,6 +712,7 @@ static part_transition ptransitions[PT_NUM] =
/* PBCN */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, /* PBCN */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GPMP */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, /* GPMP */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* CLST */ {IPL, NT, IPH, NT, ITL, NT, 1256.0f, PT_LAVA}, /* CLST */ {IPL, NT, IPH, NT, ITL, NT, 1256.0f, PT_LAVA},
/* DLAY */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
}; };
#undef IPL #undef IPL
#undef IPH #undef IPH

View File

@ -19,6 +19,8 @@ int update_SPRK(UPDATE_FUNC_ARGS) {
parts[i].life = 54; parts[i].life = 54;
if (ct == PT_SWCH) if (ct == PT_SWCH)
parts[i].life = 14; parts[i].life = 14;
if (ct == PT_DLAY)
parts[i].temp = *((float*)(&parts[i].tmp2));
return 0; return 0;
} }
if (ct==PT_SPRK) if (ct==PT_SPRK)
@ -128,6 +130,8 @@ int update_SPRK(UPDATE_FUNC_ARGS) {
if (ct==PT_INST&&rt!=PT_NSCN) conduct_sprk = 0; if (ct==PT_INST&&rt!=PT_NSCN) conduct_sprk = 0;
if (ct==PT_SWCH && (rt==PT_PSCN||rt==PT_NSCN||rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR)) if (ct==PT_SWCH && (rt==PT_PSCN||rt==PT_NSCN||rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR))
conduct_sprk = 0; conduct_sprk = 0;
if (ct==PT_DLAY && !((rt==PT_PSCN || rt==PT_NSCN) && parts[i].tmp!=(r>>8)))
conduct_sprk = 0;
if (rt==PT_QRTZ && !((ct==PT_NSCN||ct==PT_METL||ct==PT_PSCN||ct==PT_QRTZ) && (parts[r>>8].temp<173.15||pv[(y+ry)/CELL][(x+rx)/CELL]>8))) if (rt==PT_QRTZ && !((ct==PT_NSCN||ct==PT_METL||ct==PT_PSCN||ct==PT_QRTZ) && (parts[r>>8].temp<173.15||pv[(y+ry)/CELL][(x+rx)/CELL]>8)))
conduct_sprk = 0; conduct_sprk = 0;
if (rt==PT_NTCT && !(ct==PT_NSCN || ct==PT_NTCT || (ct==PT_PSCN&&parts[r>>8].temp>373.0f))) if (rt==PT_NTCT && !(ct==PT_NSCN || ct==PT_NTCT || (ct==PT_PSCN&&parts[r>>8].temp>373.0f)))
@ -138,6 +142,8 @@ int update_SPRK(UPDATE_FUNC_ARGS) {
conduct_sprk = 0; conduct_sprk = 0;
if (rt==PT_INST&&ct!=PT_PSCN) if (rt==PT_INST&&ct!=PT_PSCN)
conduct_sprk = 0; conduct_sprk = 0;
if (rt==PT_DLAY && !(ct==PT_PSCN || ct==PT_NSCN))
conduct_sprk = 0;
if (conduct_sprk) { if (conduct_sprk) {
if (rt==PT_WATR||rt==PT_SLTW) { if (rt==PT_WATR||rt==PT_SLTW) {
@ -156,12 +162,20 @@ int update_SPRK(UPDATE_FUNC_ARGS) {
} }
} }
else if (parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8)<i && parts[i].life<4))) { else if (parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8)<i && parts[i].life<4))) {
if (rt==PT_DLAY) {
parts[r>>8].life = (int)(parts[r>>8].temp - 273.15f);
parts[r>>8].tmp = i;
parts[r>>8].tmp2 = *((int*)(&parts[r>>8].temp));
parts[r>>8].ctype = rt;
part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
} else {
parts[r>>8].life = 4; parts[r>>8].life = 4;
parts[r>>8].ctype = rt; parts[r>>8].ctype = rt;
part_change_type(r>>8,x+rx,y+ry,PT_SPRK); part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
if (parts[r>>8].temp+10.0f<673.0f&&!legacy_enable&&(rt==PT_METL||rt==PT_BMTL||rt==PT_BRMT||rt==PT_PSCN||rt==PT_NSCN||rt==PT_ETRD||rt==PT_NBLE||rt==PT_IRON)) if (parts[r>>8].temp+10.0f<673.0f&&!legacy_enable&&(rt==PT_METL||rt==PT_BMTL||rt==PT_BRMT||rt==PT_PSCN||rt==PT_NSCN||rt==PT_ETRD||rt==PT_NBLE||rt==PT_IRON))
parts[r>>8].temp = parts[r>>8].temp+10.0f; parts[r>>8].temp = parts[r>>8].temp+10.0f;
} }
}
else if (ct==PT_ETRD && parts[i].life==5) else if (ct==PT_ETRD && parts[i].life==5)
{ {
part_change_type(i,x,y,ct); part_change_type(i,x,y,ct);

View File

@ -21,6 +21,7 @@ int update_SWCH(UPDATE_FUNC_ARGS) {
parts[i].life = 10; parts[i].life = 10;
} }
else if (rt==PT_SPRK&&parts[i].life==10&&parts[r>>8].ctype!=PT_PSCN&&parts[r>>8].ctype!=PT_NSCN) { else if (rt==PT_SPRK&&parts[i].life==10&&parts[r>>8].ctype!=PT_PSCN&&parts[r>>8].ctype!=PT_NSCN) {
if (parts[r>>8].ctype==PT_DLAY && parts[r>>8].life > 2) continue;
part_change_type(i,x,y,PT_SPRK); part_change_type(i,x,y,PT_SPRK);
parts[i].ctype = PT_SWCH; parts[i].ctype = PT_SWCH;
parts[i].life = 4; parts[i].life = 4;