Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

WormbotReporter.WIR_GameRules


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
/******************************************************************************
Copyright (c) 2005-2007 by Wormbo <wormbo@online.de>
$Id$

Catches score and pickup notifications.
******************************************************************************/


class WIR_GameRules extends GameRules;


//=============================================================================
// Variables
//=============================================================================

var MutWormbot MyMutator;

var struct TPendingKill {
  var Pawn Killed;
  var Controller Killer;
  var class<DamageType> DamageType;
  var vector HitLocation;
} PendingKill;


//== PostBeginPlay ============================================================
/**
Register the GameRules actor and initialize it.
*/
//=============================================================================

event PostBeginPlay()
{
  Level.Game.AddGameModifier(Self);
  MyMutator = MutWormbot(Owner);
}


//== CheckEndGame =============================================================
/**
Remeber the end game reason.
*/
//=============================================================================

function bool CheckEndGame(PlayerReplicationInfo Winner, string Reason)
{
  local bool bHandleEndGame;
  
  bHandleEndGame = Super.CheckEndGame(Winner, Reason);
  MyMutator.GameEndReason = Reason;
  return bHandleEndGame;
}


//== ScoreKill ================================================================
/**
Report a kill.
*/
//=============================================================================

function ScoreKill(Controller Killer, Controller Killed)
{
  if ( MyMutator != None && Killed != None ) {
    if ( PendingKill.Killer == Killer && PendingKill.Killed != None && Killed.Pawn == PendingKill.Killed )
      MyMutator.ScoreKill(Killer, Killed, PendingKill.DamageType);
    else
      MyMutator.ScoreKill(Killer, Killed);
  }
  Super.ScoreKill(Killer, Killed);
}


//== PreventDeath =============================================================
/**
Capture the damage type for a potential score kill.
*/
//=============================================================================

function bool PreventDeath(Pawn Killed, Controller Killer, class<DamageType> DamageType, vector HitLocation)
{
  PendingKill.Killed      = Killed;
  PendingKill.Killer      = Killer;
  PendingKill.DamageType  = DamageType;
  PendingKill.HitLocation = HitLocation;
  
  return Super.PreventDeath(Killed, Killer, DamageType, HitLocation);
}


//== ScoreObjective ===========================================================
/**
Report a goal, capture, etc.
*/
//=============================================================================

function ScoreObjective(PlayerReplicationInfo Scorer, int Score)
{
  if ( MyMutator != None && class'WIR_Util'.static.IsPlayer(Scorer) )
    MyMutator.ScoreObjective(Controller(Scorer.Owner), Score);
  
  Super.ScoreObjective(Scorer, Score);
}


//== OverridePickupQuery ======================================================
/**
Report a pickup.
*/
//=============================================================================

function bool OverridePickupQuery(Pawn Other, Pickup Item, out byte bAllowPickup)
{
  if ( MyMutator != None && MyMutator.MyGameHandler != None && MyMutator.MyGameHandler.ReportPickups > 0
      && Other != None && class'WIR_Util'.static.IsPlayer(Other) ) {
    if ( Item.Event == class'Actor'.default.Event )
      Item.Event = MyMutator.Name;
    MyMutator.Tag = Item.Event;
  }
  return Super.OverridePickupQuery(Other, Item, bAllowPickup);
}


Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Mo 12.3.2007 10:46:18.000 - Creation time: Do 14.8.2014 09:58:55.648 - Created with UnCodeX