fix STKM being unable to pick up most energy particles, or LOLZ/LOVE

This commit is contained in:
jacob1 2015-12-18 20:02:49 -05:00
parent edf180b94e
commit 139bdd7f4d
2 changed files with 27 additions and 21 deletions

View File

@ -892,14 +892,14 @@ void GameController::Update()
if (activeTool->GetIdentifier().find("DEFAULT_PT_") != activeTool->GetIdentifier().npos) if (activeTool->GetIdentifier().find("DEFAULT_PT_") != activeTool->GetIdentifier().npos)
{ {
int sr = activeTool->GetToolID(); 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) if (sr && sim->IsValidElement(sr))
rightSelected = sr; rightSelected = sr;
} }
if (!sim->player.spwn) if (!sim->player.spwn)
sim->player.elem = rightSelected; Element_STKM::STKM_set_element(sim, &sim->player, rightSelected);
if (!sim->player2.spwn) if (!sim->player2.spwn)
sim->player2.elem = rightSelected; Element_STKM::STKM_set_element(sim, &sim->player2, rightSelected);
} }
if(renderOptions && renderOptions->HasExited) if(renderOptions && renderOptions->HasExited)
{ {

View File

@ -78,8 +78,7 @@ int Element_STKM::run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
float rocketBootsHeadEffectV = 0.3f;// stronger acceleration vertically, to counteract gravity float rocketBootsHeadEffectV = 0.3f;// stronger acceleration vertically, to counteract gravity
float rocketBootsFeetEffectV = 0.45f; float rocketBootsFeetEffectV = 0.45f;
if ((parts[i].ctype>0 && parts[i].ctype<PT_NUM && sim->elements[parts[i].ctype].Enabled && sim->elements[parts[i].ctype].Falldown>0) || parts[i].ctype==SPC_AIR || parts[i].ctype == PT_NEUT || parts[i].ctype == PT_PHOT || parts[i].ctype == PT_LIGH) STKM_set_element(sim, playerp, parts[i].ctype);
playerp->elem = parts[i].ctype;
playerp->frames++; playerp->frames++;
//Temperature handling //Temperature handling
@ -365,16 +364,7 @@ int Element_STKM::run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
if (!r && !sim->bmap[(y+ry)/CELL][(x+rx)/CELL]) if (!r && !sim->bmap[(y+ry)/CELL][(x+rx)/CELL])
continue; continue;
if (sim->elements[r&0xFF].Falldown != 0 STKM_set_element(sim, playerp, r&0xFF);
|| sim->elements[r&0xFF].Properties&TYPE_GAS
|| sim->elements[r&0xFF].Properties&TYPE_LIQUID
|| (r&0xFF) == PT_NEUT || (r&0xFF) == PT_PHOT)
{
if (!playerp->rocketBoots || (r&0xFF)!=PT_PLSM)
playerp->elem = r&0xFF; //Current element
}
if ((r&0xFF)==PT_TESC || (r&0xFF)==PT_LIGH)
playerp->elem = PT_LIGH;
if ((r&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP if ((r&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP
{ {
if (parts[i].life<=95) if (parts[i].life<=95)
@ -677,5 +667,21 @@ void Element_STKM::STKM_init_legs(Simulation * sim, playerst* playerp, int i)
playerp->frames = 0; playerp->frames = 0;
} }
//#TPT-Directive ElementHeader Element_STKM static void STKM_set_element(Simulation *sim, playerst *playerp, int element)
void Element_STKM::STKM_set_element(Simulation *sim, playerst *playerp, int element)
{
if (sim->elements[element].Falldown != 0
|| sim->elements[element].Properties&TYPE_GAS
|| sim->elements[element].Properties&TYPE_LIQUID
|| sim->elements[element].Properties&TYPE_ENERGY
|| element == PT_LOLZ || element == PT_LOVE || element == SPC_AIR)
{
if (!playerp->rocketBoots || element != PT_PLSM)
playerp->elem = element;
}
if (element == PT_TESC || element == PT_LIGH)
playerp->elem = PT_LIGH;
}
Element_STKM::~Element_STKM() {} Element_STKM::~Element_STKM() {}