stickmen element defaults to right selected element if possible, or else still DUST
This commit is contained in:
parent
aa59c89fa2
commit
6a4cc7e1f7
@ -839,7 +839,27 @@ void GameController::Update()
|
|||||||
else
|
else
|
||||||
gameView->SetSample(gameModel->GetSimulation()->GetSample(pos.X, pos.Y));
|
gameView->SetSample(gameModel->GetSimulation()->GetSample(pos.X, pos.Y));
|
||||||
|
|
||||||
gameModel->GetSimulation()->update_particles();
|
Simulation * sim = gameModel->GetSimulation();
|
||||||
|
sim->update_particles();
|
||||||
|
|
||||||
|
//if either STKM or STK2 isn't out, reset it's selected element. Defaults to PT_DUST unless right selected is something else
|
||||||
|
//This won't run if the stickmen dies in a frame, since it respawns instantly
|
||||||
|
if (!sim->player.spwn || !sim->player2.spwn)
|
||||||
|
{
|
||||||
|
int rightSelected = PT_DUST;
|
||||||
|
Tool * activeTool = gameModel->GetActiveTool(1);
|
||||||
|
if (activeTool->GetIdentifier().find("DEFAULT_PT_") != activeTool->GetIdentifier().npos)
|
||||||
|
{
|
||||||
|
int sr = activeTool->GetToolID();
|
||||||
|
if ((sr>0 && sr<PT_NUM && sim->elements[sr].Enabled && sim->elements[sr].Falldown>0) || sr==SPC_AIR || sr == PT_NEUT || sr == PT_PHOT || sr == PT_LIGH)
|
||||||
|
rightSelected = sr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sim->player.spwn)
|
||||||
|
sim->player.elem = rightSelected;
|
||||||
|
if (!sim->player2.spwn)
|
||||||
|
sim->player2.elem = rightSelected;
|
||||||
|
}
|
||||||
if(renderOptions && renderOptions->HasExited)
|
if(renderOptions && renderOptions->HasExited)
|
||||||
{
|
{
|
||||||
delete renderOptions;
|
delete renderOptions;
|
||||||
|
@ -2915,7 +2915,6 @@ int Simulation::create_part(int p, int x, int y, int tv)
|
|||||||
parts[i].life = 100;
|
parts[i].life = 100;
|
||||||
Element_STKM::STKM_init_legs(this, &player, i);
|
Element_STKM::STKM_init_legs(this, &player, i);
|
||||||
player.spwn = 1;
|
player.spwn = 1;
|
||||||
player.elem = PT_DUST;
|
|
||||||
player.rocketBoots = false;
|
player.rocketBoots = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2931,7 +2930,6 @@ int Simulation::create_part(int p, int x, int y, int tv)
|
|||||||
parts[i].life = 100;
|
parts[i].life = 100;
|
||||||
Element_STKM::STKM_init_legs(this, &player2, i);
|
Element_STKM::STKM_init_legs(this, &player2, i);
|
||||||
player2.spwn = 1;
|
player2.spwn = 1;
|
||||||
player2.elem = PT_DUST;
|
|
||||||
player2.rocketBoots = false;
|
player2.rocketBoots = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3521,9 +3519,14 @@ void Simulation::update_particles_i(int start, int inc)
|
|||||||
kill_part(i);
|
kill_part(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//the main particle loop function, goes over all particles.
|
|
||||||
|
|
||||||
|
if (parts[i].type == PT_SPAWN && !player.spwn)
|
||||||
|
create_part(-1, parts[i].x, parts[i].y, PT_STKM);
|
||||||
|
else if (parts[i].type == PT_SPAWN2 && !player2.spwn)
|
||||||
|
create_part(-1, parts[i].x, parts[i].y, PT_STKM2);
|
||||||
|
}
|
||||||
|
|
||||||
|
//the main particle loop function, goes over all particles.
|
||||||
for (i=0; i<=parts_lastActiveIndex; i++)
|
for (i=0; i<=parts_lastActiveIndex; i++)
|
||||||
if (parts[i].type)
|
if (parts[i].type)
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ Element_SPAWN::Element_SPAWN()
|
|||||||
|
|
||||||
Weight = 100;
|
Weight = 100;
|
||||||
|
|
||||||
Temperature = R_TEMP+0.0f +273.15f;
|
Temperature = R_TEMP+273.15f;
|
||||||
HeatConduct = 0;
|
HeatConduct = 0;
|
||||||
Description = "STKM spawn point.";
|
Description = "STKM spawn point.";
|
||||||
|
|
||||||
@ -42,19 +42,8 @@ Element_SPAWN::Element_SPAWN()
|
|||||||
HighTemperature = ITH;
|
HighTemperature = ITH;
|
||||||
HighTemperatureTransition = NT;
|
HighTemperatureTransition = NT;
|
||||||
|
|
||||||
Update = &Element_SPAWN::update;
|
Update = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_SPAWN static int update(UPDATE_FUNC_ARGS)
|
|
||||||
int Element_SPAWN::update(UPDATE_FUNC_ARGS)
|
|
||||||
{
|
|
||||||
if (!sim->player.spwn)
|
|
||||||
sim->create_part(-1, x, y, PT_STKM);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Element_SPAWN::~Element_SPAWN() {}
|
Element_SPAWN::~Element_SPAWN() {}
|
||||||
|
@ -26,7 +26,7 @@ Element_SPAWN2::Element_SPAWN2()
|
|||||||
|
|
||||||
Weight = 100;
|
Weight = 100;
|
||||||
|
|
||||||
Temperature = R_TEMP+0.0f +273.15f;
|
Temperature = R_TEMP+273.15f;
|
||||||
HeatConduct = 0;
|
HeatConduct = 0;
|
||||||
Description = "STK2 spawn point.";
|
Description = "STK2 spawn point.";
|
||||||
|
|
||||||
@ -42,19 +42,8 @@ Element_SPAWN2::Element_SPAWN2()
|
|||||||
HighTemperature = ITH;
|
HighTemperature = ITH;
|
||||||
HighTemperatureTransition = NT;
|
HighTemperatureTransition = NT;
|
||||||
|
|
||||||
Update = &Element_SPAWN2::update;
|
Update = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_SPAWN2 static int update(UPDATE_FUNC_ARGS)
|
|
||||||
int Element_SPAWN2::update(UPDATE_FUNC_ARGS)
|
|
||||||
{
|
|
||||||
if (!sim->player2.spwn)
|
|
||||||
sim->create_part(-1, x, y, PT_STKM2);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Element_SPAWN2::~Element_SPAWN2() {}
|
Element_SPAWN2::~Element_SPAWN2() {}
|
||||||
|
Reference in New Issue
Block a user