mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
New feature: interactive actions allow various actions (hacking/reading/drinking/...) from user-defined xml acttions. The exact results can be set in a lua function.
For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=23144&goto=346447&#msg_346447 This is fully savegame compatible. GameDir >= r2333 is required. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8278 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1118,4 +1118,39 @@ BOOLEAN HasFoodInInventory( SOLDIERTYPE *pSoldier, BOOLEAN fCheckFood, BOOLEAN f
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void DrinkFromWaterTap( SOLDIERTYPE* pSoldier )
|
||||
{
|
||||
if ( !pSoldier )
|
||||
return;
|
||||
|
||||
// dont feed our machines
|
||||
if ( pSoldier->ubProfile == ROBOT || IsVehicle( pSoldier ) )
|
||||
return;
|
||||
|
||||
if ( gGameOptions.fFoodSystem )
|
||||
{
|
||||
INT32 watertoadd = max( 0, FoodMoraleMods[FOOD_NORMAL].bThreshold - pSoldier->bDrinkLevel );
|
||||
|
||||
if ( watertoadd > 0 )
|
||||
{
|
||||
AddFoodpoints( pSoldier->bDrinkLevel, watertoadd );
|
||||
}
|
||||
}
|
||||
|
||||
if ( GetWaterQuality( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ) == WATER_POISONOUS )
|
||||
HandlePossibleInfection( pSoldier, NULL, INFECTION_TYPE_BADWATER );
|
||||
|
||||
INT32 bpadded = 100 * min( 20, 100 - pSoldier->bBreath );
|
||||
|
||||
DeductPoints( pSoldier, 20, -bpadded );
|
||||
|
||||
// play water sound
|
||||
if ( pSoldier->bTeam == gbPlayerNum && gGameExternalOptions.fFoodEatingSounds )
|
||||
{
|
||||
PlayJA2SampleFromFile( "Sounds\\watertap.wav", RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) );
|
||||
}
|
||||
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szInteractiveActionText[8], pSoldier->GetName( ) );
|
||||
}
|
||||
Reference in New Issue
Block a user