-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEtmanVehicle_Traffic.uc
59 lines (42 loc) · 1.44 KB
/
EtmanVehicle_Traffic.uc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
class EtmanVehicle_Traffic extends EtmanVehicle;
var pawn myDriver;
simulated function PostBeginPlay()
{
`log("#########__ Etman Vehicle Traffic PostBeginPlay _ ##########");
super.PostBeginPlay();
`Log("#####__ Vehicle Pawn is Here -> "@ self @" __#####");
myDriver = Spawn(class'EtmanVehicle_Driver' ,,, Location + vect(0,100,0));
`Log("#####__ Driver is ready -> "@ myDriver @" __#####");
if (self.DriverEnter(myDriver))
`Log("#######__ LOLOLOLOLOOOOOOOWWYYYYYYYYY __########");
Self.Mesh.WakeRigidBody();
}
function bool DriverEnter(Pawn P)
{
local Controller C;
`Log("#####__ Driver Enter Pawn P -> "@ P @" __#####");
`Log("#####__ Pawn Controller -> "@ P.Controller @" __#####");
// Set pawns current controller to control the vehicle pawn instead
C = P.Controller;
Driver = P;
Driver.StartDriving( self );
if ( Driver.Health <= 0 )
{
Driver = None;
return false;
}
SetDriving(true);
// Disconnect PlayerController from Driver and connect to Vehicle.
C.Unpossess();
Driver.SetOwner( Self ); // This keeps the driver relevant.
C.Possess( Self, true );
if( PlayerController(C) != None && !C.IsChildState(C.GetStateName(), LandMovementState) )
{
PlayerController(C).GotoState( LandMovementState );
}
WorldInfo.Game.DriverEnteredVehicle(self, P);
return true;
}
defaultProperties
{
}