From bf935ac7d8900d62db5007f0a6be13a0afb1491b Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Wed, 18 Apr 2012 18:40:14 +0100 Subject: [PATCH] TPT: fusion step 2 + modify temp/pressure of step 1 803ded3b33 --- src/elements/h2.cpp | 17 +++++++++-------- src/elements/nble.cpp | 27 +++++++++++++++++++++++++++ src/simulation/ElementFunctions.h | 1 + src/simulation/SimulationData.cpp | 2 +- 4 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 src/elements/nble.cpp diff --git a/src/elements/h2.cpp b/src/elements/h2.cpp index 7298ebc1e..8ebc1a9bb 100644 --- a/src/elements/h2.cpp +++ b/src/elements/h2.cpp @@ -43,23 +43,24 @@ int update_H2(UPDATE_FUNC_ARGS) if (rand()%5 < 1) { int j; + float temp = parts[i].temp; sim->part_change_type(i,x,y,PT_PLSM); parts[i].life = rand()%150+50; - sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT); - sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC); + j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT); + j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC); j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PHOT); - if (j) parts[j].ctype = 0xFFFF00; + if (j != -1) { parts[j].ctype = 0xFFFF00; parts[j].temp = temp; } j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NBLE); - if (j) parts[j].tmp = 1; + if (j != -1) { parts[j].tmp = 1; parts[j].temp = temp; } + if (rand()%2) { j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NBLE); - if (j) parts[j].tmp = 1; + if (j != -1) { parts[j].tmp = 1; parts[j].temp = temp; } } - if (parts[i].temp < 4273.15) - parts[i].temp = 4273.15; - sim->pv[y/CELL][x/CELL] += 50; + parts[i].temp += 6000; + sim->pv[y/CELL][x/CELL] += 30; } } return 0; diff --git a/src/elements/nble.cpp b/src/elements/nble.cpp new file mode 100644 index 000000000..c35859fde --- /dev/null +++ b/src/elements/nble.cpp @@ -0,0 +1,27 @@ +#include "simulation/Element.h" + +int update_NBLE(UPDATE_FUNC_ARGS) +{ + if (parts[i].temp > 5273.15 && sim->pv[y/CELL][x/CELL] > 50.0f) + { + parts[i].tmp = 1; + if (rand()%5 < 1) + { + int j; + float temp = parts[i].temp; + sim->part_change_type(i,x,y,PT_PLSM); + parts[i].life = rand()%150+50; + sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT); + sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC); + j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PHOT); + if (j != -1) { parts[j].ctype = 0xFF0000; parts[j].temp = temp; } + + j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_CO2); + if (j != -1) parts[j].temp = temp; + + parts[i].temp += 10000; + sim->pv[y/CELL][x/CELL] += 30; + } + } + return 0; +} diff --git a/src/simulation/ElementFunctions.h b/src/simulation/ElementFunctions.h index be3f9f4ea..ad597b76d 100644 --- a/src/simulation/ElementFunctions.h +++ b/src/simulation/ElementFunctions.h @@ -107,6 +107,7 @@ int update_IGNT(UPDATE_FUNC_ARGS); int update_MISC(UPDATE_FUNC_ARGS); int update_FRAY(UPDATE_FUNC_ARGS); int update_REPL(UPDATE_FUNC_ARGS); +int update_NBLE(UPDATE_FUNC_ARGS); int update_legacy_PYRO(UPDATE_FUNC_ARGS); int update_legacy_all(UPDATE_FUNC_ARGS); int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS); diff --git a/src/simulation/SimulationData.cpp b/src/simulation/SimulationData.cpp index 47ce638ab..22181b5fc 100644 --- a/src/simulation/SimulationData.cpp +++ b/src/simulation/SimulationData.cpp @@ -237,7 +237,7 @@ part_type * LoadElements(int & elementCount) {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, 1, 1, SC_GAS, 10000.0f +273.15f, 5, "Plasma, extremely hot.", ST_NONE, TYPE_GAS|PROP_LIFE_DEC|PROP_LIFE_KILL, &update_PYRO, &graphics_PLSM}, {"ETRD", PIXPACK(0x404040), 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, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)", ST_NONE, TYPE_SOLID|PROP_CONDUCTS|PROP_LIFE_DEC, NULL, NULL}, {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, 1, 100, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice.", ST_SOLID, TYPE_SOLID, NULL, NULL}, - {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when introduced to electricity", ST_GAS, TYPE_GAS|PROP_CONDUCTS|PROP_LIFE_DEC, NULL, NULL}, + {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when introduced to electricity", ST_GAS, TYPE_GAS|PROP_CONDUCTS|PROP_LIFE_DEC, &update_NBLE, NULL}, {"BTRY", PIXPACK(0x858505), 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, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity.", ST_SOLID, TYPE_SOLID, &update_BTRY, NULL}, {"LCRY", PIXPACK(0x505050), 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_POWERED, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)", ST_SOLID, TYPE_SOLID, &update_LCRY, &graphics_LCRY}, {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!", ST_NONE, 0, &update_STKM, &graphics_STKM},