Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module TestMod;
- import IndentedStreamWriter;
- import ScriptHooks;
- import ScriptClasses;
- private import UnrealScript.TribesGame.TrObject;
- private import UnrealScript.TribesGame.TrPlayerController;
- private import UnrealScript.TribesGame.TrPawn;
- private import UnrealScript.TribesGame.TrPlayerReplicationInfo;
- private import UnrealScript.Engine.Actor;
- private import UnrealScript.TribesGame.TrDevice_RemoteArxBuster;
- private import UnrealScript.TribesGame.TrDevice_ChainGun;
- //SDK example mod
- //Spawn time 2 seconds
- //Chainguns and AutoJackals for everyone
- //Jetpack makes you fly forward
- const float metersToUnits = 50.0f;
- extern(C) HookType TribesGame_TrPlayerController_GetRespawnDelayTotalTime(TrPlayerController pThis, ref float result)
- {
- result = 2.0f;
- return HookType.Block;
- }
- extern(C) HookType TribesGame_TrPlayerReplicationInfo_GetEquipDevice(TrPlayerReplicationInfo pThis, ref ScriptClass result, ScriptClass FamilyInfo, TrObject.TR_EQUIP_POINT EquipSlot)
- {
- //Replace primary/secondary
- if (EquipSlot == TrObject.TR_EQUIP_POINT.EQP_Primary)
- {
- result = TrDevice_RemoteArxBuster.StaticClass();
- return HookType.Block;
- } else if (EquipSlot == TrObject.TR_EQUIP_POINT.EQP_Secondary)
- {
- result = TrDevice_ChainGun.StaticClass();
- return HookType.Block;
- }
- //Otherwise hand it off to the game
- return HookType.Continue;
- }
- extern(C) HookType TribesGame_TrPlayerController_PlayerMove(TrPlayerController pThis, ref void* result, float deltaTime)
- {
- TrPawn pawn = cast(TrPawn)pThis.PawnVar;
- if (pawn)
- {
- if (pThis.m_bPressingJetpack)
- {
- Rotator oldRotation = pThis.Rotation;
- pThis.UpdateRotation( deltaTime );
- Vector acceleration = pThis.Rotation.GetForward() * 90.0f * metersToUnits;
- if (pThis.Role < Actor.ENetRole.ROLE_Authority)
- {
- pThis.ReplicateMove(deltaTime, acceleration, Actor.EDoubleClickDir.DCLICK_None, oldRotation - pThis.Rotation);
- }
- else
- {
- pThis.ProcessMove(deltaTime, acceleration, Actor.EDoubleClickDir.DCLICK_None, oldRotation - pThis.Rotation);
- }
- return HookType.Block;
- }
- }
- return HookType.Continue;
- }
- void ModInit()
- {
- ScriptObject.Find!(ScriptClass)("Class TribesGame.TrDevice_ChainGun");
- TrDevice_RemoteArxBuster.DefaultProperties.m_nCarriedAmmo = 100;
- TrDevice_RemoteArxBuster.DefaultProperties.m_nMaxCarriedAmmo = 100;
- TrDevice_RemoteArxBuster.DefaultProperties.MaxAmmoCount = 100;
- TrDevice_RemoteArxBuster.DefaultProperties.FireInterval[0] = 0.15f;
- AddHook(TrPlayerController.Functions.GetRespawnDelayTotalTime, &TribesGame_TrPlayerController_GetRespawnDelayTotalTime);
- AddHook(TrPlayerReplicationInfo.Functions.GetEquipDevice, &TribesGame_TrPlayerReplicationInfo_GetEquipDevice);
- //State functions aren't in Class.Functions yet, you have to use the following method to hook them
- //"Function Package.Class.State.Function"
- AddHook("Function TribesGame.TrPlayerController.PlayerWalking.PlayerMove", &TribesGame_TrPlayerController_PlayerMove);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement