Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

# Tyrion.AI_GunnerAction

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

    //=====================================================================
    // AI_GunnerAction
    // Actions that involve a mounts that shoot
    //=====================================================================

    class AI_GunnerAction extends AI_Action
    	abstract;

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

    var(Parameters) Vehicle.VehiclePositionType position;

    //=====================================================================
    // Functions

    //---------------------------------------------------------------------
    // Accessor functions for resource

    final function Rook rook()
    {
    	return Rook(AI_GunnerResource(resource).m_pawn);
    }

    final function Vehicle vehicle()
    {
    	return Vehicle(AI_GunnerResource(resource).m_pawn);
    }

    final function Turret turret()
    {
    	return Turret(AI_GunnerResource(resource).m_pawn);
    }

    // returns the rook representing the vehicle mounted turret or the vehicle (for drivers) or the turret
    final function Rook localRook()
    {
    	local AI_GunnerResource gunnerResource;

    	gunnerResource = AI_GunnerResource(resource);

    	if ( gunnerResource.index < 0 )
    		return Turret(gunnerResource.m_pawn);
    	else
    		return Vehicle(gunnerResource.m_pawn).positions[gunnerResource.index].toBePossessed;
    }

    function AI_VehicleResource vehicleResource()
    {
    	local Turret turret;
    	local Vehicle vehicle;

    	turret = Turret(AI_GunnerResource(resource).m_pawn);
    	vehicle = Vehicle(AI_GunnerResource(resource).m_pawn);

    	if ( turret != None )
    		return AI_VehicleResource(turret.vehicleAI);

    	if ( vehicle != None )
    		return AI_VehicleResource(vehicle.vehicleAI);

    	return None;
    }

    //---------------------------------------------------------------------
    // Return the resource class for this action

    static function class<Tyrion_ResourceBase> getResourceClass()
    {
    	return class'AI_GunnerResource';
    }

    //---------------------------------------------------------------------
    // Depending on the type of action, find the resource the action should
    // be attached to

    static function Tyrion_ResourceBase findResource( Pawn p )
    {
    	local Vehicle vehicle;
    	local Turret turret;

    	vehicle = Vehicle(p);
    	turret = Turret(p);

    	if ( vehicle != None )
    	{
    		// There's no way of identifying gunner resources uniquely with just the pawn
    		// What should really happen is that the caller of findResource attaches a goal to every gunner position
    		return vehicle.positions[1].toBePossessed.mountAI;
    	}

    	if ( turret != None )
    		return turret.mountAI;

    	return None;
    }

    //=======================================================================

    function classConstruct()
    {
    	// GunnerActions don't use the resource - because if they did firing actions on the driver would conflict with
    	// movement actions on the driver. Without having two separate resources this will allow them to coexist.
    	// (just don't ever start up multiple firing actions!)
    	resourceUsage = 0;
    }

    defaultproperties
    {
    }

Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

Class file time: ne 5.9.2004 15:54:16.000 - Creation time: st 23.5.2018 00:10:41.306 - Created with UnCodeX