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

# Gameplay.VehicleEntry

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
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137

    class VehicleEntry extends UseableObject
    	notplaceable;

    var float EntryTriggerDelay;
    var	float TriggerTime;

    var private Vehicle.VehiclePositionType primaryPosition;
    var private int primaryPositionIndex;
    var array<Vehicle.VehiclePositionType> secondaryPositions;

    var private Vehicle ownerVehicle;

    function InventoryStationAccess getCorrespondingInventoryStation()
    {
    	if (ownerVehicle.isInventoryPosition(primaryPosition))
    		return ownerVehicle.getUnusedInventoryStation();
    	return None;
    }

    function initialiseVehicleEntry(Vehicle.VehiclePositionType _primaryPosition, Vehicle _ownerVehicle)
    {
    	ownerVehicle = _ownerVehicle;
    	primaryPosition = _primaryPosition;
    	primaryPositionIndex = ownerVehicle.getPositionIndex(primaryPosition);
    }

    function Vehicle.VehiclePositionType getPrimaryPosition()
    {
    	return primaryPosition;
    }

    simulated function Touch(Actor Other)
    {
    	// copied from BulldogTrigger

    	local Pawn user;

    	// Paul: added super.Touch() for UseableObject triggers.
    	super.Touch(Other);

    	if (Other.Instigator != None)
    	{
    		user = Pawn(Other);

    		if (user == None)
    			return;

    		if (EntryTriggerDelay > 0 )
    		{
    			if (Level.TimeSeconds - TriggerTime < EntryTriggerDelay)
    				return;
    			TriggerTime = Level.TimeSeconds;
    		}

    		// send a string message to the toucher

    	}
    }

    function UsedBy(Pawn user)
    {
    	local Character characterUser;

    	if (bDeleteMe || !ownerVehicle.isAlive())
    		return;

    	characterUser = Character(user);
    	if (characterUser == None)
    		return;

    	if (ownerVehicle.tryToOccupy(characterUser, primaryPosition, secondaryPositions) >= 0)
    		super.UsedBy(user);
    }

    //
    // TBD: Can't use an entry point if it is already full. Not quite sure
    // how to handle this, because it looks like an attempt will be made to
    // go for the secondary position if this one is taken. Also, the prompt
    // should probably reflect what you are REALLY going to do if you press
    // Use on this entry point. Another problem: the entries in the vehicle
    // are not client side, so calling this function will require a client to
    // server replicated call in vehicle... Alex?
    //
    simulated function bool CanBeUsedBy(Pawn User)
    {
    	local byte dummy;
    	return ownerVehicle.canOccupy(Character(user), primaryPosition, secondaryPositions, dummy) != -1;
    }

    static function string getPrompt(byte PromptIndex, class<Actor> dataClass)
    {
    	local class<Vehicle> VehicleClass;

    	if (PromptIndex == 255)
    		return super.getPrompt(PromptIndex, dataClass);

    	VehicleClass = class<Vehicle>(dataClass);
    	if (VehicleClass != None)
    		return VehicleClass.static.getPrompt(PromptIndex);

    	return "";
    }

    function byte GetPromptIndex(Character PotentialUser)
    {
    	local byte promptIndex;

    	if (bDeleteMe)
    	{
    		warn("attempting to get prompt index on a deleted vehicle entry");
    		return 255;
    	}

    	ownerVehicle.canOccupy(PotentialUser, primaryPosition, secondaryPositions, promptIndex);

    	return promptIndex;
    }

    function class<Actor> GetPromptDataClass()
    {
    	return ownerVehicle.class;
    }

    defaultproperties
    {
    	bHardAttach=True
    	bHidden=True
    	bCollideActors=false
    	bStatic=false
    	CollisionRadius=+0080.000000
    	CollisionHeight=+0400.000000
    	bCollideWhenPlacing=False
    	EntryTriggerDelay=0.1
    	bOnlyAffectPawns=true
    	RemoteRole=ROLE_None
    	bAlwaysUse=true
    }

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

Class file time: ne 5.9.2004 15:53:28.000 - Creation time: st 23.5.2018 00:10:50.421 - Created with UnCodeX