Files
dsrc/sku.0/sys.server/compiled/game/script/poi/prisonbreak/bombed_wall.script
T

68 lines
1.7 KiB
Plaintext

/**
*
* Title: bombed_wall.script
* Description: script for destroyable wall: POI = prisonbreak
*/
// Also used by "prisonbreak" POI.
//------------------------------------------------
// Includes
//------------------------------------------------
include library.poi;
//------------------------------------------------
// Constants
//------------------------------------------------
const string LOG_NAME = "poiPrisonBreak Bombed Wall";
//------------------------------------------------
// enableBombedWall
//
// Called on a wall that is ready to be attacked.
//------------------------------------------------
messageHandler enableBombedWall()
{
setObjVar( self, "enabled", true );
return SCRIPT_CONTINUE;
}
//------------------------------------------------
// OnObjectDamaged
//
// Notifies the master the first time we are damaged.
//------------------------------------------------
trigger OnObjectDamaged( obj_id attacker, obj_id weapon, int damage )
{
// Do nothing if we aren't enabled.
if ( !hasObjVar( self, "enabled" ) )
return SCRIPT_CONTINUE;
// When damaged for the first time, tell the prisoners to celebrate.
boolean wallDamaged = getBooleanObjVar( self, "wallDamaged" );
if ( !wallDamaged )
{
// Mark us as damaged so we don't do this again.
setObjVar( self, "wallDamaged", true );
// Get master reference.
obj_id poiMaster = getObjIdObjVar( self, "poi.baseObject" );
if ( (poiMaster == null) || (poiMaster == obj_id.NULL_ID) )
return SCRIPT_CONTINUE;
// Indicate that we have been damaged.
dictionary params = new dictionary();
params.put( "attacker", attacker );
messageTo( poiMaster, "wallDamaged", params, 0, false );
}
return SCRIPT_CONTINUE;
}