home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 58 / pcpp58b_TRIBES.iso / Tribes / base / scripts.vol / sensor.cs < prev    next >
Encoding:
Text File  |  1998-12-16  |  5.2 KB  |  211 lines

  1. //-------------------------------------------------------------------------- 
  2. //-------------------------------------------------------------------------- 
  3.  
  4. //-------------------------------------------------------------------------- 
  5. // Default sensor methods
  6.  
  7. function Sensor::onActivate(%this)
  8. {
  9.     if(GameBase::isPowered(%this)) {
  10.         GameBase::playSequence(%this,0,"power");
  11.     }
  12. }
  13.  
  14. function Sensor::onDeactivate(%this)
  15. {
  16.     GameBase::pauseSequence(%this,0);
  17. }
  18.  
  19. function Sensor::onPower(%this,%power,%generator)
  20. {
  21.     if (%power) {
  22.         %this.shieldStrength = 0.03;
  23.         GameBase::setRechargeRate(%this,10);
  24.     }
  25.     else {
  26.         %this.shieldStrength = 0;
  27.         GameBase::setRechargeRate(%this,0);
  28.     }
  29.     GameBase::setActive(%this,%power);
  30. }
  31.  
  32. function Sensor::onEnabled(%this)
  33. {
  34.     if (GameBase::isPowered(%this)) {
  35.         %this.shieldStrength = 0.03;                  
  36.         GameBase::setRechargeRate(%this,10);
  37.         GameBase::setActive(%this,true);
  38.     }
  39. }
  40.  
  41. function Sensor::onDisabled(%this)
  42. {
  43.     %this.shieldStrength = 0;
  44.     GameBase::setRechargeRate(%this,0);
  45.     Sensor::onDeactivate(%this);
  46. }
  47.  
  48. function Sensor::onDestroyed(%this)
  49. {
  50.     StaticShape::objectiveDestroyed(%this);
  51.     %this.shieldStrength = 0;
  52.     GameBase::setRechargeRate(%this,0);
  53.     Sensor::onDeactivate(%this);
  54.     %sensorName = GameBase::getDataName(%this);
  55.     if(%sensorName == DeployableSensorJammer) 
  56.        $TeamItemCount[GameBase::getTeam(%this) @ "DeployableSensorJammerPack"]--;
  57.     else if(%sensorName == DeployableMotionSensor) 
  58.        $TeamItemCount[GameBase::getTeam(%this) @ "MotionSensorPack"]--;
  59.     else if(%sensorName == DeployablePulseSensor) 
  60.        $TeamItemCount[GameBase::getTeam(%this) @ "PulseSensorPack"]--;
  61.     calcRadiusDamage(%this, $DebrisDamageType, 2.5, 0.05, 25, 13, 2, 0.40, 
  62.         0.1, 250, 100);
  63. }
  64.  
  65. function Sensor::onDamage(%this,%type,%value,%pos,%vec,%mom,%object)
  66. {
  67.    if(%this.objectiveLine)
  68.         %this.lastDamageTeam = GameBase::getTeam(%object);
  69.     %TDS= 1;
  70.     if(GameBase::getTeam(%this) == GameBase::getTeam(%object))
  71.         %TDS = $Server::TeamDamageScale;
  72.     StaticShape::shieldDamage(%this,%type,%value * %TDS,%pos,%vec,%mom,%object);
  73. }
  74.  
  75.  
  76. //------------------------------------------------------------------------
  77.  
  78. SensorData PulseSensor
  79. {
  80.    description = "Large Pulse Sensor";
  81.    shapeFile = "radar";
  82. //   explosionId = DebrisExp;
  83.    maxDamage = 1.5;
  84.    range = 400;
  85.    dopplerVelocity = 0;
  86.    castLOS = true;
  87.    supression = false;
  88.     visibleToSensor = true;
  89.     sequenceSound[0] = { "power", SoundSensorPower };
  90.     mapFilter = 4;
  91.     mapIcon = "M_Radar";
  92.     debrisId = flashDebrisLarge;
  93.    shieldShapeName = "shield_medium";
  94.     maxEnergy = 100;
  95.     damageSkinData = "objectDamageSkins";
  96.     shadowDetailMask = 16;
  97.     explosionId = LargeShockwave;
  98. };
  99.  
  100.  
  101. //------------------------------------------------------------------------
  102.  
  103. SensorData MediumPulseSensor
  104. {
  105.    description = "Medium Pulse Sensor";
  106.    shapeFile = "sensor_pulse_med";
  107. //   explosionId = DebrisExp;
  108.    maxDamage = 1.0;
  109.    range = 250;
  110.    dopplerVelocity = 0;
  111.    castLOS = true;
  112.    supression = false;
  113.     visibleToSensor = true;
  114.     sequenceSound[0] = { "power", SoundSensorPower };
  115.     mapFilter = 4;
  116.     mapIcon = "M_Radar";
  117.     debrisId = flashDebrisLarge;
  118.    shieldShapeName = "shield_medium";
  119.     maxEnergy = 100;
  120.     damageSkinData = "objectDamageSkins";
  121.     shadowDetailMask = 16;
  122. };
  123.  
  124.  
  125. //------------------------------------------------------------------------
  126.  
  127. SensorData DeployableMotionSensor
  128. {
  129.    description = "Motion Sensor";
  130.     className = "DeployableSensor";
  131.     shapeFile = "sensor_small";
  132.     shadowDetailMask = 16;
  133.     visibleToSensor = true;
  134.     sequenceSound[0] = { "deploy", SoundActivateMotionSensor };
  135. //   explosionId = DebrisExp;
  136.     damageLevel = {0.8, 1.0};
  137.     maxDamage = 0.4;
  138.     debrisId = defaultDebrisSmall;
  139.     range = 50;
  140.     dopplerVelocity = 1;
  141.    castLOS = false;
  142.    supression = false;
  143.     supressable = false;
  144.     pinger = false;
  145.     mapFilter = 4;
  146.     mapIcon = "M_motionSensor";
  147.     damageSkinData = "objectDamageSkins";
  148. };
  149.  
  150.  
  151. SensorData DeployablePulseSensor
  152. {
  153.     description = "Remote Pulse Sensor";
  154.     className = "DeployableSensor";
  155.     shapeFile = "radar_small";
  156.     shadowDetailMask = 4;
  157.     visibleToSensor = true;
  158.     sequenceSound[0] = { "deploy", SoundActivateMotionSensor };
  159.     damageLevel = {0.8, 1.0};
  160.     maxDamage = 1.0;
  161. //   explosionId = DebrisExp;
  162.     debrisId = flashDebrisSmall;
  163.     range = 200;
  164.     castLOS = true;
  165.     supression = false;
  166.     mapFilter = 4;
  167.     mapIcon = "M_Radar";
  168. };
  169.  
  170.  
  171. SensorData DeployableSensorJammer
  172. {
  173.     description = "Remote Sensor Jammer";
  174.     className = "DeployableSensor";
  175.     shapeFile = "sensor_jammer";
  176.     shadowDetailMask = 4;
  177.     visibleToSensor = true;
  178.     sequenceSound[0] = { "deploy", SoundActivateMotionSensor };
  179.     damageLevel = {0.8, 1.0};
  180.     maxDamage = 0.5;
  181. //    explosionId = DebrisExp;
  182.     debrisId = defaultDebrisSmall;
  183.     range = 80;
  184.     castLOS = true;
  185.     supression = true;
  186.     mapFilter = 4;
  187.     mapIcon = "M_sensorJammer";
  188. };
  189.  
  190.  
  191.  
  192. function DeployableSensor::onAdd(%this)
  193. {
  194.     schedule("DeployableSensor::deploy(" @ %this @ ");",1,%this);
  195. }
  196.  
  197. function DeployableSensor::deploy(%this)
  198. {
  199.     GameBase::playSequence(%this,1,"deploy");
  200. }
  201.  
  202. function DeployableSensor::onEndSequence(%this,%thread)
  203. {
  204.     GameBase::setActive(%this,true);
  205.     GameBase::playSequence(%this,0,"power");
  206. }
  207.  
  208. //------------------------------------------------------------------------
  209.  
  210.  
  211.