Skip to content

Instantly share code, notes, and snippets.

@moonheart08
Created March 17, 2018 01:49
Show Gist options
  • Save moonheart08/c08bdd8a938c484e6358bd00e8262442 to your computer and use it in GitHub Desktop.
Save moonheart08/c08bdd8a938c484e6358bd00e8262442 to your computer and use it in GitHub Desktop.
#include "simulation/Elements.h"
//#TPT-Directive ElementClass Element_DRIL PT_DRIL 186
Element_DRIL::Element_DRIL()
{
Identifier = "DEFAULT_PT_DRIL";
Name = "DRIL";
Colour = PIXPACK(0xFFE0A0);
MenuVisible = 1;
MenuSection = SC_NUCLEAR;
Enabled = 1;
Advection = 0.0f;
AirDrag = 0.00f;
AirLoss = 0.00f;
Loss = 0.00f;
Collision = 0.0f;
Gravity = 0.0f;
Diffusion = 0.00f;
HotAir = 0.000f * CFDS;
Falldown = 0;
Flammable = 0;
Explosive = 0;
Meltable = 0;
Hardness = 30;
Weight = 85;
Temperature = R_TEMP+0.0f +273.15f;
HeatConduct = 70;
Description = "A big fucking drill";
Properties = TYPE_PART | TYPE_SOLID;
LowPressure = IPL;
LowPressureTransition = NT;
HighPressure = IPH;
HighPressureTransition = NT;
LowTemperature = ITL;
LowTemperatureTransition = NT;
HighTemperature = ITH;
HighTemperatureTransition = NT;
Update = &Element_DRIL::update;
Graphics = &Element_DRIL::graphics;
}
//#TPT-Directive ElementHeader Element_DRIL static int update(UPDATE_FUNC_ARGS)
int Element_DRIL::update(UPDATE_FUNC_ARGS) {
switch (parts[i].life) {
case 0:
parts[i].tmp = 0;
parts[i].tmp2 = -1;
break;
case 1:
parts[i].tmp = 0;
parts[i].tmp2 = 1;
break;
case 2:
parts[i].tmp = -1;
parts[i].tmp2 = 0;
break;
case 3:
parts[i].tmp = 1;
parts[i].tmp2 = 0;
break;
default:
parts[i].tmp = 0;
parts[i].tmp2 = 0;
break;
}
int relativex = parts[i].tmp+x, relativey = parts[i].tmp2+y;
if (pmap[relativey][relativex]) {
sim->part_change_type(ID(pmap[relativey][relativex]), relativex, relativey, PT_NONE);
}
}
//#TPT-Directive ElementHeader Element_DRIL static int graphics(GRAPHICS_FUNC_ARGS)
int Element_DRIL::graphics(GRAPHICS_FUNC_ARGS) {
ren->addpixel(cpart->tmp + nx, cpart->tmp2 + ny, 0x90, 0x90, 0x90, 0xFF);
return 0;
}
Element_DRIL::~Element_DRIL() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment