Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
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 |
// Network KActor that works on server and client // // Simplified form NetKActor http://mods.beyondunreal.com/mod.php?id=200. // All credits go to the GoodKarma group. -- Jijun Wang class KNActor extends KActor placeable; var KRigidBodyState KState, KRepState; var bool bReceiveStateNew; var byte StateCount, LastStateCount; replication { reliable if(Role == ROLE_Authority) KRepState, StateCount; } // This even is for updating the state (position, velocity etc.) of the tire's karma // body when we get new information from the network. simulated event bool KUpdateState(out KRigidBodyState newState) { if(Level.NetMode == NM_DedicatedServer || StateCount == LastStateCount) return false; newState = KrepState; LastStateCount = StateCount; return true; } function Tick(float Delta) { Super.Tick(Delta); if (Level.NetMode == NM_DedicatedServer) PackState(); } // Pack current state to be sent to the client. // Should only get called on the server. function PackState() { local bool bChanged; if(!KIsAwake()) return; KGetRigidBodyState(KState); bChanged = bChanged || VSize(KRBVecToVector(KState.Position) - KRBVecToVector(KRepState.Position)) > 1.0; bChanged = bChanged || VSize(KRBVecToVector(KState.LinVel) - KRBVecToVector(KRepState.LinVel)) > 0.2; bChanged = bChanged || VSize(KRBVecToVector(KState.AngVel) - KRBVecToVector(KRepState.AngVel)) > 0.2; if(bChanged) { KRepState = KState; StateCount++; } return; } simulated event Bump(Actor Other) { if(!KIsAwake()) KWake() ; } simulated event FellOutOfWorld(eKillZType KillType) { bTearOff = true ; SetPhysics(PHYS_None) ; bHidden = true ; } defaultproperties { bNetNotify=True RemoteRole=ROLE_SimulatedProxy StaticMesh=StaticMesh'USARSim_VehicleParts_Meshes.Test.TestBody' Begin Object Class=KarmaParams Name=KarmaParams0 KMass=0.500000 bHighDetailOnly=False bClientOnly=False bKDoubleTickRate=True KFriction=0.500000 KRestitution=0.200000 KMaxSpeed=25 KImpactThreshold=100000.000000 End Object KParams=KarmaParams'USARBot.KNActor.KarmaParams0' bPathColliding=True } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |