Permalink
Browse files

New element: GRVT (gravitons), energy particle that creates Newtonian…

… Gravity
  • Loading branch information...
jacob1 committed Jul 3, 2014
1 parent 856aae4 commit 70676aba4af355b769f4f92ee0d6c1633f812840
Showing with 86 additions and 0 deletions.
  1. +12 −0 src/simulation/Simulation.cpp
  2. +74 −0 src/simulation/elements/GVRT.cpp
@@ -2054,7 +2054,10 @@ void Simulation::init_can_move()
|| destinationType == PT_H2)
can_move[PT_PHOT][destinationType] = 2;
if (destinationType != PT_DMND && destinationType != PT_INSL && destinationType != PT_VOID && destinationType != PT_PVOD && destinationType != PT_VIBR && destinationType != PT_PRTI && destinationType != PT_PRTO)
{
can_move[PT_PROT][destinationType] = 2;
can_move[PT_GRVT][destinationType] = 2;
}
}
//other special cases that weren't covered above
@@ -3048,6 +3051,15 @@ int Simulation::create_part(int p, int x, int y, int tv)
parts[i].vy = 2.0f*sinf(a);
break;
}
case PT_GRVT:
{
float a = (rand()%360)*3.14159f/180.0f;
parts[i].life = 250 + rand()%200;
parts[i].vx = 2.0f*cosf(a);
parts[i].vy = 2.0f*sinf(a);
parts[i].tmp = 7;
break;
}
case PT_TRON:
{
int randhue = rand()%360;
@@ -0,0 +1,74 @@
#include "simulation/Elements.h"
//#TPT-Directive ElementClass Element_GRVT PT_GRVT 177
Element_GRVT::Element_GRVT()
{
Identifier = "DEFAULT_PT_GRVT";
Name = "GRVT";
Colour = PIXPACK(0x00EE76);
MenuVisible = 1;
MenuSection = SC_NUCLEAR;
Enabled = 1;
Advection = 0.0f;
AirDrag = 0.00f * CFDS;
AirLoss = 1.00f;
Loss = 1.00f;
Collision = -.99f;
Gravity = 0.0f;
Diffusion = 0.00f;
HotAir = 0.000f * CFDS;
Falldown = 0;
Flammable = 40;
Explosive = 0;
Meltable = 0;
Hardness = 1;
Weight = -1;
Temperature = R_TEMP+273.15f;
HeatConduct = 61;
Description = "Gravitons. Create Newtonian Gravity.";
State = ST_GAS;
Properties = TYPE_ENERGY|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC;
LowPressure = IPL;
LowPressureTransition = NT;
HighPressure = IPH;
HighPressureTransition = NT;
LowTemperature = ITL;
LowTemperatureTransition = NT;
HighTemperature = ITH;
HighTemperatureTransition = NT;
Update = &Element_GRVT::update;
Graphics = &Element_GRVT::graphics;
}
//#TPT-Directive ElementHeader Element_GRVT static int update(UPDATE_FUNC_ARGS)
int Element_GRVT::update(UPDATE_FUNC_ARGS)
{
//at higher tmps they just go completely insane
if (parts[i].tmp >= 100)
parts[i].tmp = 100;
if (parts[i].tmp <= -100)
parts[i].tmp = -100;
sim->gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] = 0.2f*parts[i].tmp;
return 0;
}
//#TPT-Directive ElementHeader Element_GRVT static int graphics(GRAPHICS_FUNC_ARGS)
int Element_GRVT::graphics(GRAPHICS_FUNC_ARGS)
{
*firea = 5;
*firer = 0;
*fireg = 250;
*fireb = 170;
*pixel_mode |= FIRE_BLEND;
return 1;
}
Element_GRVT::~Element_GRVT() {}

0 comments on commit 70676ab

Please sign in to comment.