Always snap to grid
UE3:UT GR Info (UT3)
From Unreal Wiki, The Unreal Engine Documentation Site
Introduction
Code
- Package:
- UT_GameDex
Enums
enum EnemyType
ET_Infantry,
ET_Hero,
ET_Vehicle,
ET_Rook,
ET_Knight,
ET_Bishop,
ET_Turret
Structs
PawnInfo
EnemyInfo
Extends: PawnInfo
Functions
SetFirstGR
function SetFirstGR()
OverridePickupQuery
function bool OverridePickupQuery(Pawn Other, class<Inventory> ItemClass, Actor Pickup, out byte bAllowPickup)
NetDamage
function NetDamage(int OriginalDamage, out int Damage, Pawn injured, Controller instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType)
Script
//=================================================== // Class: UT_GR_Info // Creation date: 12/12/2008 19:35 // Last updated: 11/04/2010 13:10 // Contributors: 00zX //--------------------------------------------------- // Attribution-Noncommercial-Share Alike 3.0 Unported // http://creativecommons.org/licenses/by-nc-sa/3.0/ //=================================================== class UT_GR_Info extends GameRules; `include(MOD.uci) enum PawnType { ET_Infantry, ET_Hero, ET_Vehicle, ET_Rook, //Castle ET_Knight, //Manta, Viper? ET_Bishop, //Hero ET_Turret }; struct PawnInfo { var Pawn Pawn; var PawnType Type; }; struct EnemyInfo extends PawnInfo { var bool bIsBot; var bool bIsFriendly; var int Damage; var int ModifiedDamage; //ConversionRatio>?? var class<DamageType> DamageType; structdefaultproperties { bIsBot=false bIsFriendly=false Damage=0 ModifiedDamage=0 DamageType=class'DmgType_Suicided' } }; var UT_MDB_GameExp GameExp; var private UT_MDB_GameRules BaseGameRules; /** wtf why am I grey? */ function SetBaseGameRules() { if(GameExp == None) return; `logd("GameRules Info Controller Initalized!",,'GameRulesInfo'); BaseGameRules = GameExp.GetBaseGameRules(); `logd("BaseGameRules:"$BaseGameRules,,'GameRulesInfo'); } static function PawnType GetPawnType(Pawn Pawn) { local PawnType PType; if(ClassIsChildOf(Pawn.class,class'UTPawn')) { //Added Rook 2.0 if(Pawn.IsA('UTHeroPawn')) { if(UTHeroPawn(Pawn).bIsHero && !UTHeroPawn(Pawn).bIsSuperHero) PType = ET_Hero; else if (!UTHeroPawn(Pawn).bIsHero && UTHeroPawn(Pawn).bIsSuperHero) PType = ET_Rook; } else PType = ET_Infantry; } //isA UTVehicle else if(ClassIsChildOf(Pawn.class, class'UTVehicle')) { if(ClassIsChildOf(Pawn.class, class'UTVehicle_TrackTurretBase')) PType = ET_Turret; else PType = ET_Vehicle; } return PType; } function bool HandleRestartGame() { if((NextGameRules != None) && NextGameRules.HandleRestartGame()) return true; return false; } function bool CheckEndGame(PlayerReplicationInfo Winner, string Reason) { if(NextGameRules != None) return NextGameRules.CheckEndGame(Winner,Reason); return true; } function bool OverridePickupQuery(Pawn Other, class<Inventory> ItemClass, Actor Pickup, out byte bAllowPickup) { if(GameExp == None || BaseGameRules == None) return false; if(Pickup != None && UTPawn(Other) != None) if((BaseGameRules != None) && BaseGameRules.PickupQuery(UTPawn(Other), ItemClass, Pickup)) return true; return false; } function ScoreObjective(PlayerReplicationInfo Scorer, Int Score) { /* local UT_MDB_EventNotifier.NotifyMode HandleNotify; local int idx; HandleNotify = (EventName = ET_OnExit, NotifyName = NT_Vehicle); for(GR = BaseGameRules; GR != None; GR = GetNextGameRules(GR)) { idx = GR.EventNotifier.Notifies.find(HandleNotify); if(idx != Index_None) GR.ScoreObjective(Scorer,Score); }*/ } function ScoreKill(Controller Killer, Controller Killed) { /* local UT_MDB_EventNotifier.NotifyMode HandleNotify; local int idx; HandleNotify = (EventName = ET_OnExit, NotifyName = NT_Vehicle); for(GR = BaseGameRules; GR != None; GR = GetNextGameRules(GR)) { idx = GR.EventNotifier.Notifies.find(HandleNotify); if(idx != Index_None) GR.ScoreKill(Killer,Killed); }*/ } //Cumulative //TODO: SUPPORT OTHER MUTS, USE THE LINKED LIST ONTOP OF OBJECT LIST!!~ function NetDamage(int OriginalDamage, out int Damage, pawn injured, Controller instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType) { local EnemyInfo Enemy; if(GameExp == None || BaseGameRules == None) return; if(!WorldInfo.Game.IsInState('MatchInProgress') || (injured == None && instigatedBy == None)) { Damage = 0; return; } //GameInfo.ReduceDamage // then check if carrying items that can reduce damage // if((damage > 0) && (injured.InvManager != None)) // injured.InvManager.ModifyDamage(Damage, instigatedBy, HitLocation, Momentum, DamageType); if(instigatedBy != None && instigatedBy.Pawn != None) { Enemy.Pawn = InstigatedBy.Pawn; Enemy.Damage = OriginalDamage; Enemy.Type = GetPawnType(Enemy.Pawn); /* if(ClassIsChildOf(Enemy.Pawn.class,class'UTPawn')) { //Added Rook 2.0 if(Enemy.Pawn.IsA('UTHeroPawn')) { if(UTHeroPawn(InstigatedBy.Pawn).bIsHero && !UTHeroPawn(InstigatedBy.Pawn).bIsSuperHero) Enemy.Type = ET_Hero; else if (!UTHeroPawn(InstigatedBy.Pawn).bIsHero && UTHeroPawn(InstigatedBy.Pawn).bIsSuperHero) Enemy.Type = ET_Rook; } else Enemy.Type = ET_Infantry; } //Enemy isA UTVehicle else if(ClassIsChildOf(InstigatedBy.Pawn.class, class'UTVehicle')) { if(ClassIsChildOf(InstigatedBy.Pawn.class, class'UTVehicle_TrackTurretBase')) Enemy.Type = ET_Turret; else Enemy.Type = ET_Vehicle; }*/ //Enemy isA UTBot if(UTBot(instigatedBy) != None && UTBot(injured.controller) == None && UTBot(injured.controller) != UTBot(instigatedBy)) Enemy.bIsBot = true; //Self-Damage if(Enemy.Pawn == injured) Damage = BaseGameRules.ModifySelfDamage(Enemy); //Damage From EnemyPawn else if(injured != instigatedBy) { //Team Damage if(WorldInfo.Game.bTeamGame) { if(instigatedBy.GetTeamNum() != injured.GetTeamNum()) Damage = BaseGameRules.ModifyDamageTaken(Enemy, Injured); else Enemy.bIsFriendly = true; } //FFA Damage else Damage = BaseGameRules.ModifyDamageTaken(Enemy, Injured); } } }