Beispiel #1
0
// jumppad (engbatxr, etc)
void trigger_jumper_touch ( )
{
    gedict_t *finder;

    if ( !Activated( self, other ) )
    {
        if ( self->else_goal )
        {
            finder = Findgoal( self->else_goal );
            if ( finder)
                DoResults ( finder, other, ( self->goal_result & 2));
        }
        return;
    }

    if ( other->s.v.classname == "grenade" || !streq( other->s.v.classname, "player" ) )
        return;
    else
    {
        if ( other->s.v.health > 0 && !self->armorclass )
        {
            other->s.v.velocity[2] = self->speed * 7;
            if ( streq( other->s.v.classname, "player" ) )
            {
                if ( other->fly_sound < g_globalvars.time )
                {
                    other->fly_sound = g_globalvars.time + 1.5;
                    if ( !( ( int ) self->s.v.spawnflags & 2 ) )
                        sound ( other, 0, "misc/boing.wav", 1, 1);
                }
            }
        }
    }
    if ( (int) self->s.v.spawnflags & 1 )
        dremove ( self );
}
Beispiel #2
0
void CPrecipitator::EvalProducts()
  {
  try {
    x[0] = x[1] = x[2] = x[3] = 0.0;
    m_dPrevFlow = m_dExtCoolVolFlow;

    FlwIOs.AddMixtureIn_Id(Feed, idFeed);
    MStream & Prod = FlwIOs[FlwIOs.First[idProd]].Stream; //Reference to the output stream
    //optional connections...
    const int iCoolInIndex = FlwIOs.First[idCoolI];
    const int iCoolOutIndex = FlwIOs.First[idCoolO];
    const int iEvapIndex = FlwIOs.First[idEvap];
    bCoolIn = (iCoolInIndex>=0);
    bCoolOut = (iCoolOutIndex>=0);
    m_bEvapConnected = (iEvapIndex>=0);



//     MStream CoolIn;
//     MStream &CoolOut = FlwIOs[FlwIOs.First[idCoolO]].Stream;
//     MStream &Evap1 = FlwIOs[FlwIOs.First[idEvap]].Stream;
    Evap.SetF(Feed, MP_All, 0.0);
    
    Prod = Feed;

    Log.SetCondition(iCoolType && (!bCoolIn || !bCoolOut), 3, MMsg_Error, "Bad External cooling connections");

    if (iCoolType==COOL_EXTERNAL && bCoolIn && bCoolOut) {
      FlwIOs.AddMixtureIn_Id(CoolIn, idCoolI);
      MStream &CoolOut = FlwIOs[iCoolOutIndex].Stream;
      if (Valid(CoolIn.T) && fabs(CoolIn.Mass())>1.0e-5 && fabs(CoolIn.Mass())>1.0e-5) {
	m_dExtCoolTemp = CoolIn.T;                  // The temperature of the return stream
	//	m_dExtCoolRate = CoolOut.totHz()-CoolIn.totHz();
	m_dExtCoolRate = m_dCoolOutTotHz-CoolIn.totHz();
	//      CoolingSanityCheck();
      } else {
	m_dExtCoolRate = 0.0;
	m_dExtCoolTemp = Feed.T;
      }
    }
	
    if (iCoolType==COOL_INTERNAL && bCoolIn) {
      FlwIOs.AddMixtureIn_Id(CoolIn, idCoolI);
    }



    
    m_dHIn = Feed.totHz();
    
    dThermalLoss = 0.0;
    dYield  = 0.0;
    dSALin  = 0.0;
    dDiamin = 0.0;
    bool streamOK = true;

    MIBayer & ProdB=Prod.IF<MIBayer>(false);   // Do the checks up front
    Log.SetCondition(IsNothing(ProdB), 1, MMsg_Warning, "Bad Feed Stream - Not Bayer Model");

    MISSA & ProdSSA = Prod.IF<MISSA>(false);
    Log.SetCondition(IsNothing(ProdSSA), 1, MMsg_Warning, "Bad Feed Stream - No SSA Available");
    if (IsNothing(ProdB) || IsNothing(ProdSSA)) streamOK = false;

    dSALin  = ProdSSA.SpecificSurfaceAreaVol(); // m^2/L
    dDiamin = ProdSSA.PartDiamFromSAM();
    m_dSSAin = ProdSSA.SpecificSurfaceAreaMass();
    


    if (bOnLine && streamOK) {  // Online and have Bayer and SSA properties...
      DoPrecip(Prod);

      if (iCoolType==COOL_EXTERNAL && bCoolOut) {
	MStream &CoolOut = FlwIOs[iCoolOutIndex].Stream;
	double den = Prod.Density();
	if (m_bByVolFlow) {
	  m_dExtCoolFlow = (1-m_dVolDamping)*m_dExtCoolVolFlow*den + m_dVolDamping*m_dPrevFlow;
	  m_dPrevFlow = m_dExtCoolFlow;
	} else 
	  m_dExtCoolVolFlow = m_dExtCoolFlow/den;
	CoolOut.SetM(Prod, MP_All, m_dExtCoolFlow);
	m_dCoolOutTotHz = CoolOut.totHz();
      }
      if (iCoolType==COOL_INTERNAL && bCoolOut && bCoolIn && iCoolMethod==COOL_Hx) {
	MStream &CoolOut = FlwIOs[iCoolOutIndex].Stream;
	CoolOut.SetF(CoolIn, MP_All, 1.0);
	if (m_bCoolerOn)
	  CoolOut.T = m_dCoolWaterTout;
	else
	  CoolOut.T = CoolIn.T;
      }
      




      DoResults(Prod);

      Evap.T = Prod.T;
      if (m_bEvapConnected) {
        MStream &Evap1 = FlwIOs[iEvapIndex].Stream;
        Evap1 = Evap;
      }

//       Evap1 = Evap;
//       Evap1.T = Prod.T;
      m_dHEvap = Evap.totHz();
      m_dHOut = Prod.totHz();
      m_dHBal = m_dHIn - m_dHEvap - m_dHOut;
      dTout = Prod.T;
      dTin = Feed.T;

    } else  {   // Just tidy up and put some sensible stuff in the results...
      dTin    = Feed.T;
      dTout   = dTin;
      dACin   = (IsNothing(ProdB) ? 0.0 : ProdB.AtoC());
      dACout  = dACin;
      dReactionHeat  = 0.0;
      dResidenceTime = 0.0;
      dYield = 0.0;
      dTHAPrecip = 0.0;
      dSolPrecip = 0.0;
      if (iCoolType==COOL_INTERNAL && bCoolOut && bCoolIn && iCoolMethod==COOL_Hx) {
	MStream &CoolOut = FlwIOs[iCoolOutIndex].Stream;
	CoolOut.SetF(CoolIn, MP_All, 1.0);
	CoolOut.T = CoolIn.T;
	m_dCoolWaterTout = CoolIn.T;
	m_dCoolRate = 0.0;
      }
      
    }
  }
  catch (MMdlException &e)
    {
    Log.Message(MMsg_Error, e.Description);
    }
  catch (MFPPException &e)
    {
    e.ClearFPP();
    Log.Message(MMsg_Error, e.Description);
    }
  catch (MSysException &e)
    {
    Log.Message(MMsg_Error, e.Description);
    }
  catch (...)
    {
    Log.Message(MMsg_Error, "Some Unknown Exception occured");
    }
  }