Revert weapon conversion
This patch reverts first step of global weapon conversion that would have halted the release of the next version for too long.
This commit is contained in:
parent
3c46801714
commit
12d95e387e
757 changed files with 10788 additions and 4046 deletions
466
sources/Weapons/BaseWeaponClasses/Pistols/NiceDualies.uc
Normal file
466
sources/Weapons/BaseWeaponClasses/Pistols/NiceDualies.uc
Normal file
|
|
@ -0,0 +1,466 @@
|
|||
class NiceDualies extends NiceWeapon;
|
||||
var class<NiceSingle> SingleClass;
|
||||
var name altFlashBoneName;
|
||||
var name altTPAnim;
|
||||
var Actor altThirdPersonActor;
|
||||
var name altWeaponAttach;
|
||||
// Track ammo in each gun separately
|
||||
var int MagAmmoRemLeft, MagAmmoRemLeftClient;
|
||||
var int MagAmmoRemRight, MagAmmoRemRightClient;
|
||||
// Variables for managing dual-pistols reload
|
||||
var const string leftEjectStr, rightEjectStr; // Event names that trigger when magazines ejected
|
||||
var const string leftInsertStr, rightInsertStr; // Event names that trigger when magazines inserted
|
||||
var float leftEject, rightEject; // Frame at which magazines ejected
|
||||
var float leftInsert, rightInsert; // Frame at which magazines inserted
|
||||
// This weapon is currently switching and soon won't exist
|
||||
var bool bSwitching;
|
||||
replication{
|
||||
reliable if(Role < ROLE_Authority)
|
||||
ServerUpdateWeaponMag, ServerSetDualMagSize, ServerReduceDualMag, ServerSwitchToSingle, ServerSwitchToGivenSingle;
|
||||
reliable if(Role == ROLE_Authority)
|
||||
MagAmmoRemLeft, MagAmmoRemRight, ClientSetDualMagSize;
|
||||
reliable if(bNetOwner && bNetDirty && (Role == ROLE_Authority))
|
||||
altThirdPersonActor;
|
||||
}
|
||||
simulated function PostBeginPlay(){
|
||||
super.PostBeginPlay();
|
||||
SetupDualReloadEvents();
|
||||
reloadPreEndFrame = FMin(leftEject, rightEject);
|
||||
reloadEndFrame = FMax(leftInsert, rightInsert);
|
||||
DemoReplacement = SingleClass;
|
||||
}
|
||||
simulated function SetupDualReloadEvents(){
|
||||
local EventRecord record;
|
||||
relEvents.Length = 0;
|
||||
record.eventName = leftEjectStr;
|
||||
record.eventFrame = leftEject;
|
||||
relEvents[relEvents.Length] = record;
|
||||
record.eventName = rightEjectStr;
|
||||
record.eventFrame = rightEject;
|
||||
relEvents[relEvents.Length] = record;
|
||||
record.eventName = leftInsertStr;
|
||||
record.eventFrame = leftInsert;
|
||||
relEvents[relEvents.Length] = record;
|
||||
record.eventName = rightInsertStr;
|
||||
record.eventFrame = rightInsert;
|
||||
relEvents[relEvents.Length] = record;
|
||||
}
|
||||
// Don't use that one for dualies
|
||||
simulated function AddReloadedAmmo(){}
|
||||
// Use this one
|
||||
simulated function ReloadEvent(string eventName){
|
||||
local int halfMag;
|
||||
local int totalAvailableAmmo;
|
||||
UpdateMagCapacity(Instigator.PlayerReplicationInfo);
|
||||
halfMag = GetSingleMagCapacity();
|
||||
totalAvailableAmmo = AmmoAmount(0);
|
||||
totalAvailableAmmo -= (MagAmmoRemLeftClient + MagAmmoRemRightClient);
|
||||
// Handle ejection
|
||||
if(eventName ~= leftEjectStr){
|
||||
MagAmmoRemLeftClient = 0;
|
||||
ServerSetDualMagSize(MagAmmoRemLeftClient, MagAmmoRemRightClient, Level.TimeSeconds);
|
||||
NiceDualies(Instigator.Weapon).GetMagazineAmmo();
|
||||
return;
|
||||
}
|
||||
else if(eventName ~= rightEjectStr){
|
||||
MagAmmoRemRightClient = 0;
|
||||
ServerSetDualMagSize(MagAmmoRemLeftClient, MagAmmoRemRightClient, Level.TimeSeconds);
|
||||
NiceDualies(Instigator.Weapon).GetMagazineAmmo();
|
||||
return;
|
||||
}
|
||||
// Handle reload
|
||||
if(totalAvailableAmmo < 0)
|
||||
return;
|
||||
if(eventName ~= leftInsertStr){
|
||||
MagAmmoRemLeftClient += totalAvailableAmmo;
|
||||
MagAmmoRemLeftClient = Min(MagAmmoRemLeftClient, halfMag);
|
||||
}
|
||||
else if(eventName ~= rightInsertStr){
|
||||
MagAmmoRemRightClient += totalAvailableAmmo;
|
||||
MagAmmoRemRightClient = Min(MagAmmoRemRightClient, halfMag);
|
||||
}
|
||||
NiceDualies(Instigator.Weapon).GetMagazineAmmo();
|
||||
ServerSetDualMagSize(MagAmmoRemLeftClient, MagAmmoRemRightClient, Level.TimeSeconds);
|
||||
}
|
||||
simulated function BringUp(optional Weapon PrevWeapon){
|
||||
super.BringUp(PrevWeapon);
|
||||
ApplyLaserState();
|
||||
}
|
||||
simulated function ApplyLaserState(){
|
||||
super.ApplyLaserState();
|
||||
if(NiceAttachment(altThirdPersonActor) != none)
|
||||
NiceAttachment(altThirdPersonActor).SetLaserType(LaserType);
|
||||
}
|
||||
simulated function ZoomIn(bool bAnimateTransition){
|
||||
super.ZoomIn(bAnimateTransition);
|
||||
if(bAnimateTransition){
|
||||
if(bZoomOutInterrupted)
|
||||
PlayAnim('GOTO_Iron',1.0,0.1);
|
||||
else
|
||||
PlayAnim('GOTO_Iron',1.0,0.1);
|
||||
}
|
||||
}
|
||||
simulated function ZoomOut(bool bAnimateTransition){
|
||||
local float AnimLength, AnimSpeed;
|
||||
super.ZoomOut(false);
|
||||
if(bAnimateTransition){
|
||||
AnimLength = GetAnimDuration('GOTO_Hip', 1.0);
|
||||
if(ZoomTime > 0 && AnimLength > 0)
|
||||
AnimSpeed = AnimLength/ZoomTime;
|
||||
else
|
||||
AnimSpeed = 1.0;
|
||||
PlayAnim('GOTO_Hip',AnimSpeed,0.1);
|
||||
}
|
||||
}
|
||||
function AttachToPawn(Pawn P){
|
||||
local name BoneName;
|
||||
Super.AttachToPawn(P);
|
||||
if(altThirdPersonActor == none){
|
||||
altThirdPersonActor = Spawn(AttachmentClass, Owner);
|
||||
InventoryAttachment(altThirdPersonActor).InitFor(self);
|
||||
}
|
||||
else
|
||||
altThirdPersonActor.NetUpdateTime = Level.TimeSeconds - 1;
|
||||
BoneName = P.GetOffhandBoneFor(self);
|
||||
if(BoneName == ''){
|
||||
altThirdPersonActor.SetLocation(P.Location);
|
||||
altThirdPersonActor.SetBase(P);
|
||||
}
|
||||
else
|
||||
P.AttachToBone(altThirdPersonActor, BoneName);
|
||||
if(altThirdPersonActor != none)
|
||||
NiceDualiesAttachment(altThirdPersonActor).bIsOffHand = true;
|
||||
if(altThirdPersonActor != none && ThirdPersonActor != none){
|
||||
NiceDualiesAttachment(altThirdPersonActor).brother = NiceDualiesAttachment(ThirdPersonActor);
|
||||
NiceDualiesAttachment(ThirdPersonActor).brother = NiceDualiesAttachment(altThirdPersonActor);
|
||||
altThirdPersonActor.LinkMesh(NiceDualiesAttachment(ThirdPersonActor).BrotherMesh);
|
||||
}
|
||||
}
|
||||
simulated function DetachFromPawn(Pawn P){
|
||||
super.DetachFromPawn(P);
|
||||
if(altThirdPersonActor != none){
|
||||
altThirdPersonActor.Destroy();
|
||||
altThirdPersonActor = none;
|
||||
}
|
||||
}
|
||||
simulated function Destroyed(){
|
||||
super.Destroyed();
|
||||
if(ThirdPersonActor != none)
|
||||
ThirdPersonActor.Destroy();
|
||||
if(altThirdPersonActor != none)
|
||||
altThirdPersonActor.Destroy();
|
||||
}
|
||||
simulated function vector GetEffectStart(){
|
||||
local Vector RightFlashLoc,LeftFlashLoc;
|
||||
RightFlashLoc = GetBoneCoords(default.FlashBoneName).Origin;
|
||||
LeftFlashLoc = GetBoneCoords(default.altFlashBoneName).Origin;
|
||||
if(Instigator.IsFirstPerson()){
|
||||
if(WeaponCentered())
|
||||
return CenteredEffectStart();
|
||||
if(bAimingRifle){
|
||||
if(KFFire(GetFireMode(0)).FireAimedAnim != 'FireLeft_Iron')
|
||||
return RightFlashLoc;
|
||||
else
|
||||
return LeftFlashLoc;
|
||||
}
|
||||
else{
|
||||
if(GetFireMode(0).FireAnim != 'FireLeft')
|
||||
return RightFlashLoc;
|
||||
else
|
||||
return LeftFlashLoc;
|
||||
}
|
||||
}
|
||||
else{
|
||||
return (Instigator.Location + Instigator.EyeHeight * Vect(0, 0, 0.5) + vector(Instigator.Rotation) * 40.0);
|
||||
}
|
||||
}
|
||||
function NicePlainData.Data GetNiceData(){
|
||||
local NicePlainData.Data transferData;
|
||||
transferData = super.GetNiceData();
|
||||
class'NicePlainData'.static.SetInt(transferData, "leftMag", MagAmmoRemLeft);
|
||||
class'NicePlainData'.static.SetInt(transferData, "rightMag", MagAmmoRemRight);
|
||||
return transferData;
|
||||
}
|
||||
function SetNiceData(NicePlainData.Data transferData, optional NiceHumanPawn newOwner){
|
||||
local int halfMag;
|
||||
super.SetNiceData(transferData, newOwner);
|
||||
if(newOwner != none)
|
||||
UpdateMagCapacity(newOwner.PlayerReplicationInfo);
|
||||
halfMag = GetSingleMagCapacity();
|
||||
MagAmmoRemLeft = class'NicePlainData'.static.GetInt(transferData, "leftMag", halfMag);
|
||||
MagAmmoRemRight = class'NicePlainData'.static.GetInt(transferData, "rightMag", halfMag);
|
||||
ClientSetDualMagSize(MagAmmoRemLeft, MagAmmoRemRight);
|
||||
}
|
||||
simulated function AltFire(float F){
|
||||
if(NicePlayerController(Instigator.Controller) != none)
|
||||
ClientForceInterruptReload(CANCEL_PASSIVESWITCH);
|
||||
if(!bIsReloading)
|
||||
ServerSwitchToSingle();
|
||||
}
|
||||
simulated function FireGivenGun(bool bFireLeft){
|
||||
local NiceDualiesFire niceFireMode;
|
||||
niceFireMode = NiceDualiesFire(FireMode[0]);
|
||||
if(niceFireMode != none){
|
||||
if(bFireLeft)
|
||||
niceFireMode.ModeDoFireLeft();
|
||||
else
|
||||
niceFireMode.ModeDoFireRight();
|
||||
}
|
||||
}
|
||||
function NiceSingle ServerSwitchToGivenSingle(bool bSwitchToLeft){
|
||||
local int m;
|
||||
local int origAmmo;
|
||||
local NiceHumanPawn nicePawn;
|
||||
local NiceSingle singlePistol;
|
||||
local NicePlainData.Data transferData;
|
||||
nicePawn = NiceHumanPawn(Instigator);
|
||||
if(nicePawn == none || SingleClass == none || nicePawn.Health <= 0)
|
||||
return none;
|
||||
nicePawn.CurrentWeight -= Weight;
|
||||
Weight = 0;
|
||||
bSwitching = true;
|
||||
origAmmo = AmmoAmount(0);
|
||||
for(m = 0; m < NUM_FIRE_MODES;m ++)
|
||||
if(FireMode[m].bIsFiring)
|
||||
StopFire(m);
|
||||
DetachFromPawn(nicePawn);
|
||||
singlePistol = nicePawn.Spawn(SingleClass);
|
||||
if(singlePistol != none){
|
||||
singlePistol.Weight = default.Weight;
|
||||
singlePistol.DemoReplacement = DemoReplacement;
|
||||
transferData = GetNiceData();
|
||||
singlePistol.GiveTo(nicePawn);
|
||||
singlePistol.SetNiceData(transferData, nicePawn);
|
||||
singlePistol.bIsDual = true;
|
||||
singlePistol.Weight = default.Weight;
|
||||
singlePistol.SellValue = SellValue;
|
||||
if(bSwitchToLeft){
|
||||
singlePistol.otherMagazine = MagAmmoRemRight;
|
||||
singlePistol.MagAmmoRemaining = MagAmmoRemLeft;
|
||||
singlePistol.Ammo[0].AmmoAmount = origAmmo - MagAmmoRemRight;
|
||||
}
|
||||
else{
|
||||
singlePistol.otherMagazine = MagAmmoRemLeft;
|
||||
singlePistol.MagAmmoRemaining = MagAmmoRemRight;
|
||||
singlePistol.Ammo[0].AmmoAmount = origAmmo - MagAmmoRemLeft;
|
||||
}
|
||||
singlePistol.ClientSetMagSize(singlePistol.MagAmmoRemaining, false);
|
||||
//nicePawn.ServerChangedWeapon(self, singlePistol);
|
||||
//nicePawn.ClientChangeWeapon(singlePistol);
|
||||
}
|
||||
Destroy();
|
||||
return singlePistol;
|
||||
}
|
||||
function NiceSingle ServerSwitchToSingle(){
|
||||
return ServerSwitchToGivenSingle(MagAmmoRemLeft > MagAmmoRemRight);
|
||||
}
|
||||
function DropFrom(vector StartLocation){
|
||||
local int m;
|
||||
local int magKeep, magGive;
|
||||
local NiceHumanPawn nicePawn;
|
||||
local KFWeaponPickup weapPickup;
|
||||
local NiceSingle singlePistol;
|
||||
local int AmmoThrown, OtherAmmo;
|
||||
nicePawn = NiceHumanPawn(Instigator);
|
||||
if(nicePawn == none || !bCanThrow || SingleClass == none)
|
||||
return;
|
||||
nicePawn.CurrentWeight -= Weight;
|
||||
Weight = 0;
|
||||
bSwitching = true;
|
||||
if(MagAmmoRemLeft > MagAmmoRemRight){
|
||||
magKeep = MagAmmoRemLeft;
|
||||
magGive = MagAmmoRemRight;
|
||||
}
|
||||
else{
|
||||
magKeep = MagAmmoRemRight;
|
||||
magGive = MagAmmoRemLeft;
|
||||
}
|
||||
OtherAmmo = AmmoAmount(0);
|
||||
ClientWeaponThrown();
|
||||
for(m = 0; m < NUM_FIRE_MODES;m ++)
|
||||
if(FireMode[m].bIsFiring)
|
||||
StopFire(m);
|
||||
DetachFromPawn(nicePawn);
|
||||
AmmoThrown = magGive;
|
||||
OtherAmmo = OtherAmmo - AmmoThrown;
|
||||
singlePistol = nicePawn.Spawn(SingleClass);
|
||||
if(singlePistol != none){
|
||||
singlePistol.DemoReplacement = none;
|
||||
singlePistol.GiveTo(nicePawn);
|
||||
singlePistol.Ammo[0].AmmoAmount = OtherAmmo;
|
||||
singlePistol.MagAmmoRemaining = magKeep;
|
||||
singlePistol.ClientSetMagSize(singlePistol.MagAmmoRemaining, false);
|
||||
MagAmmoRemaining = magGive;
|
||||
//nicePawn.ServerChangedWeapon(self, singlePistol);
|
||||
//nicePawn.ClientChangeWeapon(singlePistol);
|
||||
}
|
||||
weapPickup = KFWeaponPickup(nicePawn.Spawn(SingleClass.default.PickupClass,,, StartLocation));
|
||||
if(weapPickup != none){
|
||||
weapPickup.InitDroppedPickupFor(self);
|
||||
weapPickup.Weight = default.Weight;
|
||||
weapPickup.Velocity = Velocity;
|
||||
weapPickup.AmmoAmount[0] = AmmoThrown;
|
||||
weapPickup.SellValue = SellValue / 2;
|
||||
singlePistol.SellValue = weapPickup.SellValue;
|
||||
weapPickup.MagAmmoRemaining = magGive;
|
||||
if(nicePawn.Health > 0)
|
||||
weapPickup.bThrown = true;
|
||||
}
|
||||
Destroy();
|
||||
if(KFGameType(Level.Game) != none)
|
||||
KFGameType(Level.Game).WeaponDestroyed(class);
|
||||
}
|
||||
function bool HandlePickupQuery(pickup Item){
|
||||
if(Item.InventoryType == SingleClass){
|
||||
if(LastHasGunMsgTime < Level.TimeSeconds && PlayerController(Instigator.Controller) != none){
|
||||
LastHasGunMsgTime = Level.TimeSeconds + 0.5;
|
||||
PlayerController(Instigator.Controller).ReceiveLocalizedMessage(Class'KFMainMessages', 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return super.HandlePickupQuery(Item);
|
||||
}
|
||||
// Nice functions
|
||||
simulated function int GetSingleMagCapacity(){
|
||||
return int(float(MagCapacity) * 0.5);
|
||||
}
|
||||
function UpdateWeaponMag(){
|
||||
ServerUpdateWeaponMag();
|
||||
}
|
||||
function ServerUpdateWeaponMag(){
|
||||
UpdateMagCapacity(Instigator.PlayerReplicationInfo);
|
||||
MagAmmoRemLeft = Min(MagAmmoRemLeft, GetSingleMagCapacity());
|
||||
MagAmmoRemRight = Min(MagAmmoRemRight, GetSingleMagCapacity());
|
||||
ClientSetDualMagSize(MagAmmoRemLeft, MagAmmoRemRight);
|
||||
}
|
||||
simulated function ClientUpdateWeaponMag(){
|
||||
UpdateMagCapacity(Instigator.PlayerReplicationInfo);
|
||||
MagAmmoRemLeftClient = Min(MagAmmoRemLeftClient, GetSingleMagCapacity());
|
||||
MagAmmoRemRightClient = Min(MagAmmoRemRightClient, GetSingleMagCapacity());
|
||||
ServerSetDualMagSize(MagAmmoRemLeftClient, MagAmmoRemRightClient, Level.TimeSeconds);
|
||||
}
|
||||
// Forces update for client's magazine ammo counter
|
||||
// In case we are using client-side hit-detection, client itself manages remaining ammunition in magazine, but in some cases we want server to dictate current magazine amount
|
||||
// This function sets client's mag size to a given value
|
||||
simulated function ClientSetDualMagSize(int newLeftMag, int newRightMag){
|
||||
MagAmmoRemLeftClient = newLeftMag;
|
||||
MagAmmoRemRightClient = newRightMag;
|
||||
MagAmmoRemainingClient = MagAmmoRemLeftClient + MagAmmoRemRightClient;
|
||||
}
|
||||
// This function allows clients to change magazine size without altering total ammo amount
|
||||
// It allows clients to provide time-stamps, so that older change won't override a newer one
|
||||
function ServerSetDualMagSize(int newLeftMag, int newRightMag, float updateTime){
|
||||
MagAmmoRemLeft = newLeftMag;
|
||||
MagAmmoRemRight = newRightMag;
|
||||
magAmmoRemaining = MagAmmoRemLeft + MagAmmoRemRight;
|
||||
if(LastMagUpdateFromClient <= updateTime){
|
||||
LastMagUpdateFromClient = updateTime;
|
||||
if(magAmmoRemaining > 0)
|
||||
bServerFiredLastShot = false;
|
||||
}
|
||||
}
|
||||
// This function allows clients to change magazine size along with total ammo amount on the server (to update ammo counter in client-side mode)
|
||||
// It allows clients to provide time-stamps, so that older change won't override a newer one
|
||||
// Intended to be used for decreasing ammo count from shooting and cannot increase magazine size
|
||||
function ServerReduceDualMag(int newLeftMag, int newRightMag, float updateTime, int Mode){
|
||||
local int delta;
|
||||
delta = MagAmmoRemLeft - newLeftMag;
|
||||
delta += MagAmmoRemRight - newRightMag;
|
||||
// Only update later changes that actually decrease magazine
|
||||
if(LastMagUpdateFromClient <= updateTime && delta > 0){
|
||||
LastMagUpdateFromClient = updateTime;
|
||||
MagAmmoRemLeft = newLeftMag;
|
||||
MagAmmoRemRight = newRightMag;
|
||||
ConsumeAmmo(Mode, delta);
|
||||
MagAmmoRemaining = MagAmmoRemLeft + MagAmmoRemRight;
|
||||
}
|
||||
}
|
||||
simulated function int GetMagazineAmmoLeft(){
|
||||
if(Role < ROLE_Authority)
|
||||
return MagAmmoRemLeftClient;
|
||||
else
|
||||
return MagAmmoRemLeft;
|
||||
}
|
||||
simulated function int GetMagazineAmmoRight(){
|
||||
if(Role < ROLE_Authority)
|
||||
return MagAmmoRemRightClient;
|
||||
else
|
||||
return MagAmmoRemRight;
|
||||
}
|
||||
simulated function bool AllowReload(){
|
||||
UpdateMagCapacity(Instigator.PlayerReplicationInfo);
|
||||
if(FireMode[0].IsFiring() ||
|
||||
bIsReloading || (GetMagazineAmmoLeft() >= GetSingleMagCapacity() && GetMagazineAmmoRight() >= GetSingleMagCapacity()) ||
|
||||
ClientState == WS_BringUp ||
|
||||
AmmoAmount(0) <= GetMagazineAmmo())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
simulated function WeaponTick(float dt){
|
||||
if(Role == Role_AUTHORITY)
|
||||
MagAmmoRemaining = MagAmmoRemLeft + MagAmmoRemRight;
|
||||
else
|
||||
MagAmmoRemainingClient = MagAmmoRemLeftClient + MagAmmoRemRightClient;
|
||||
super.WeaponTick(dt);
|
||||
}
|
||||
// Some functions reloaded to force update of magazine size on client's side
|
||||
function GiveAmmo(int m, WeaponPickup WP, bool bJustSpawned){
|
||||
super.GiveAmmo(m, WP, bJustSpawned);
|
||||
ClientSetDualMagSize(MagAmmoRemLeft, MagAmmoRemRight);
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
SingleClass=Class'NicePack.NiceSingle'
|
||||
altFlashBoneName="Tip_Left"
|
||||
altTPAnim="DualiesAttackLeft"
|
||||
altWeaponAttach="Bone_weapon2"
|
||||
leftEjectStr="LEFT_EJECT"
|
||||
rightEjectStr="RIGHT_EJECT"
|
||||
leftInsertStr="LEFT_INSERT"
|
||||
rightInsertStr="RIGHT_INSERT"
|
||||
leftEject=0.130000
|
||||
rightEject=0.102000
|
||||
leftInsert=0.444000
|
||||
rightInsert=0.787000
|
||||
reloadChargeEndFrame=-1.000000
|
||||
reloadMagStartFrame=-1.000000
|
||||
reloadChargeStartFrame=-1.000000
|
||||
MagazineBone=
|
||||
bHasChargePhase=False
|
||||
FirstPersonFlashlightOffset=(X=-15.000000,Z=5.000000)
|
||||
MagCapacity=30
|
||||
ReloadRate=3.500000
|
||||
ReloadAnim="Reload"
|
||||
ReloadAnimRate=1.000000
|
||||
FlashBoneName="Tip_Right"
|
||||
WeaponReloadAnim="Reload_Dual9mm"
|
||||
Weight=4.000000
|
||||
bDualWeapon=True
|
||||
bHasAimingMode=True
|
||||
IdleAimAnim="Idle_Iron"
|
||||
StandardDisplayFOV=70.000000
|
||||
TraderInfoTexture=Texture'KillingFloorHUD.Trader_Weapon_Images.Trader_Dual_9mm'
|
||||
ZoomInRotation=(Pitch=0,Roll=0)
|
||||
ZoomedDisplayFOV=65.000000
|
||||
FireModeClass(0)=Class'NicePack.NiceDualiesFire'
|
||||
FireModeClass(1)=Class'KFMod.NoFire'
|
||||
PutDownAnim="PutDown"
|
||||
AIRating=0.440000
|
||||
CurrentRating=0.440000
|
||||
bShowChargingBar=True
|
||||
Description="A pair of custom 9mm pistols. What they lack in stopping power, they compensate for with a quick refire."
|
||||
EffectOffset=(X=100.000000,Y=25.000000,Z=-10.000000)
|
||||
DisplayFOV=70.000000
|
||||
Priority=65
|
||||
InventoryGroup=2
|
||||
GroupOffset=2
|
||||
PickupClass=Class'NicePack.NiceDualiesPickup'
|
||||
PlayerViewOffset=(X=20.000000,Z=-7.000000)
|
||||
BobDamping=7.000000
|
||||
AttachmentClass=Class'NicePack.NiceDualiesAttachment'
|
||||
IconCoords=(X1=229,Y1=258,X2=296,Y2=307)
|
||||
ItemName="!!!Dual something"
|
||||
DrawScale=0.900000
|
||||
TransientSoundVolume=1.000000
|
||||
}
|
||||
13
sources/Weapons/BaseWeaponClasses/Pistols/NiceDualiesAmmo.uc
Normal file
13
sources/Weapons/BaseWeaponClasses/Pistols/NiceDualiesAmmo.uc
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
class NiceDualiesAmmo extends NiceAmmo;
|
||||
#EXEC OBJ LOAD FILE=InterfaceContent.utx
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
AmmoPickupAmount=30
|
||||
MaxAmmo=480
|
||||
InitialAmount=240
|
||||
PickupClass=Class'NicePack.NiceDualiesAmmoPickup'
|
||||
IconMaterial=Texture'KillingFloorHUD.Generic.HUD'
|
||||
IconCoords=(X1=413,Y1=82,X2=457,Y2=125)
|
||||
ItemName="Dualies bullets"
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
class NiceDualiesAmmoPickup extends NiceAmmoPickup;
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
AmmoAmount=30
|
||||
InventoryType=Class'NicePack.NiceDualiesAmmo'
|
||||
PickupMessage="Rounds (9mm)"
|
||||
StaticMesh=StaticMesh'KillingFloorStatics.DualiesAmmo'
|
||||
}
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
class NiceDualiesAttachment extends NiceAttachment;
|
||||
var bool bIsOffHand, bMyFlashTurn;
|
||||
var NiceDualiesAttachment brother;
|
||||
var Mesh BrotherMesh;
|
||||
replication{
|
||||
reliable if(Role == ROLE_Authority)
|
||||
brother;
|
||||
}
|
||||
simulated function DoFlashEmitter(){
|
||||
if(bIsOffHand)
|
||||
return;
|
||||
if(bMyFlashTurn)
|
||||
ActuallyFlash();
|
||||
else if(brother != none)
|
||||
brother.ActuallyFlash();
|
||||
}
|
||||
simulated function ActuallyFlash(){
|
||||
super.DoFlashEmitter();
|
||||
}
|
||||
simulated event ThirdPersonEffects(){
|
||||
local NicePlayerController PC;
|
||||
if((Level.NetMode == NM_DedicatedServer) || (Instigator == none))
|
||||
return;
|
||||
PC = NicePlayerController(Level.GetLocalPlayerController());
|
||||
if(FiringMode == 0){
|
||||
if(OldSpawnHitCount != SpawnHitCount){
|
||||
OldSpawnHitCount = SpawnHitCount;
|
||||
GetHitInfo();
|
||||
if(((Instigator != none) && (Instigator.Controller == PC)) || (VSize(PC.ViewTarget.Location - mHitLocation) < 4000)){
|
||||
if(PC != Instigator.Controller){
|
||||
if(mHitActor != none)
|
||||
Spawn(class'ROBulletHitEffect',,, mHitLocation, Rotator(-mHitNormal));
|
||||
CheckForSplash();
|
||||
SpawnTracer();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(FlashCount > 0){
|
||||
if(KFPawn(Instigator) != none){
|
||||
if(bMyFlashTurn)
|
||||
KFPawn(Instigator).StartFiringX(false, bRapidFire);
|
||||
else
|
||||
KFPawn(Instigator).StartFiringX(true, bRapidFire);
|
||||
}
|
||||
if(bDoFiringEffects){
|
||||
if((Level.TimeSeconds - LastRenderTime > 0.2) && (Instigator.Controller != PC))
|
||||
return;
|
||||
if(bSpawnLight)
|
||||
WeaponLight();
|
||||
DoFlashEmitter();
|
||||
if(!bIsOffHand){
|
||||
if(!bMyFlashTurn)
|
||||
ThirdPersonShellEject();
|
||||
else if(brother != none)
|
||||
brother.ThirdPersonShellEject();
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
GotoState('');
|
||||
if(KFPawn(Instigator) != none)
|
||||
KFPawn(Instigator).StopFiring();
|
||||
}
|
||||
}
|
||||
simulated function vector GetTracerStart(){
|
||||
local Pawn p;
|
||||
p = Pawn(Owner);
|
||||
if((p != none) && p.IsFirstPerson() && p.Weapon != none)
|
||||
return p.Weapon.GetEffectStart();
|
||||
if(mMuzFlash3rd != none && bMyFlashTurn)
|
||||
return mMuzFlash3rd.Location;
|
||||
else if(brother != none && brother.mMuzFlash3rd != none && !bMyFlashTurn)
|
||||
return brother.mMuzFlash3rd.Location;
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
bMyFlashTurn=True
|
||||
BrotherMesh=SkeletalMesh'KF_Weapons3rd_Trip.Dual9mm_3rd'
|
||||
mMuzFlashClass=Class'ROEffects.MuzzleFlash3rdPistol'
|
||||
mTracerClass=Class'KFMod.KFNewTracer'
|
||||
mShellCaseEmitterClass=Class'KFMod.KFShellSpewer'
|
||||
MovementAnims(0)="JogF_Dual9mm"
|
||||
MovementAnims(1)="JogB_Dual9mm"
|
||||
MovementAnims(2)="JogL_Dual9mm"
|
||||
MovementAnims(3)="JogR_Dual9mm"
|
||||
TurnLeftAnim="TurnL_Dual9mm"
|
||||
TurnRightAnim="TurnR_Dual9mm"
|
||||
CrouchAnims(0)="CHwalkF_Dual9mm"
|
||||
CrouchAnims(1)="CHwalkB_Dual9mm"
|
||||
CrouchAnims(2)="CHwalkL_Dual9mm"
|
||||
CrouchAnims(3)="CHwalkR_Dual9mm"
|
||||
WalkAnims(0)="WalkF_Dual9mm"
|
||||
WalkAnims(1)="WalkB_Dual9mm"
|
||||
WalkAnims(2)="WalkL_Dual9mm"
|
||||
WalkAnims(3)="WalkR_Dual9mm"
|
||||
CrouchTurnRightAnim="CH_TurnR_Dual9mm"
|
||||
CrouchTurnLeftAnim="CH_TurnL_Dual9mm"
|
||||
IdleCrouchAnim="CHIdle_Dual9mm"
|
||||
IdleWeaponAnim="Idle_Dual9mm"
|
||||
IdleRestAnim="Idle_Dual9mm"
|
||||
IdleChatAnim="Idle_Dual9mm"
|
||||
IdleHeavyAnim="Idle_Dual9mm"
|
||||
IdleRifleAnim="Idle_Dual9mm"
|
||||
FireAnims(0)="DualiesAttackRight"
|
||||
FireAnims(1)="DualiesAttackRight"
|
||||
FireAnims(2)="DualiesAttackRight"
|
||||
FireAnims(3)="DualiesAttackRight"
|
||||
FireAltAnims(0)="DualiesAttackLeft"
|
||||
FireAltAnims(1)="DualiesAttackLeft"
|
||||
FireAltAnims(2)="DualiesAttackLeft"
|
||||
FireAltAnims(3)="DualiesAttackLeft"
|
||||
FireCrouchAnims(0)="CHDualiesAttackRight"
|
||||
FireCrouchAnims(1)="CHDualiesAttackRight"
|
||||
FireCrouchAnims(2)="CHDualiesAttackRight"
|
||||
FireCrouchAnims(3)="CHDualiesAttackRight"
|
||||
FireCrouchAltAnims(0)="CHDualiesAttackLeft"
|
||||
FireCrouchAltAnims(1)="CHDualiesAttackLeft"
|
||||
FireCrouchAltAnims(2)="CHDualiesAttackLeft"
|
||||
FireCrouchAltAnims(3)="CHDualiesAttackLeft"
|
||||
HitAnims(0)="HitF_Dual9mmm"
|
||||
HitAnims(1)="HitB_Dual9mm"
|
||||
HitAnims(2)="HitL_Dual9mm"
|
||||
HitAnims(3)="HitR_Dual9mm"
|
||||
PostFireBlendStandAnim="Blend_Dual9mm"
|
||||
PostFireBlendCrouchAnim="CHBlend_Dual9mm"
|
||||
}
|
||||
247
sources/Weapons/BaseWeaponClasses/Pistols/NiceDualiesFire.uc
Normal file
247
sources/Weapons/BaseWeaponClasses/Pistols/NiceDualiesFire.uc
Normal file
|
|
@ -0,0 +1,247 @@
|
|||
class NiceDualiesFire extends NiceFire;
|
||||
var bool bWasInZedTime;
|
||||
var Emitter Flash2Emitter;
|
||||
var Emitter ShellEject2Emitter;
|
||||
var name ShellEject2BoneName;
|
||||
var name FireAnim2, FireAimedAnim2;
|
||||
var bool bIsLeftShot;
|
||||
var float leftNextFireTime;
|
||||
var float rightNextFireTime;
|
||||
var bool bLastFiredLeft;
|
||||
simulated function ModeTick(float delta){
|
||||
local float timeCutScale;
|
||||
local NicePlayerController nicePlayer;
|
||||
if(instigator != none)
|
||||
nicePlayer = NicePlayerController(instigator.controller);
|
||||
if(nicePlayer != none && nicePlayer.IsZedTimeActive() != bWasInZedTime){
|
||||
bWasInZedTime = !bWasInZedTime;
|
||||
timeCutScale = 1.0;
|
||||
if(bWasInZedTime)
|
||||
timeCutScale = KFGameType(Level.Game).ZedTimeSlomoScale;
|
||||
niceNextFireTime = Level.TimeSeconds + (niceNextFireTime - Level.TimeSeconds) * timeCutScale;
|
||||
nextFireTime = niceNextFireTime;
|
||||
leftNextFireTime = Level.TimeSeconds + (leftNextFireTime - Level.TimeSeconds) * timeCutScale;
|
||||
rightNextFireTime = Level.TimeSeconds + (rightNextFireTime - Level.TimeSeconds) * timeCutScale;
|
||||
}
|
||||
super.ModeTick(delta);
|
||||
}
|
||||
simulated function InitEffects(){
|
||||
local NiceDualies dualWeapon;
|
||||
dualWeapon = NiceDualies(Weapon);
|
||||
if((Level.NetMode == NM_DedicatedServer) || (AIController(Instigator.Controller) != none) || dualWeapon == none)
|
||||
return;
|
||||
if((FlashEmitterClass != none) && ((FlashEmitter == none) || FlashEmitter.bDeleteMe)){
|
||||
FlashEmitter = Weapon.Spawn(FlashEmitterClass);
|
||||
Weapon.AttachToBone(FlashEmitter, dualWeapon.default.FlashBoneName);
|
||||
}
|
||||
if((FlashEmitterClass != none) && ((Flash2Emitter == none) || Flash2Emitter.bDeleteMe)){
|
||||
Flash2Emitter = Weapon.Spawn(FlashEmitterClass);
|
||||
Weapon.AttachToBone(Flash2Emitter, dualWeapon.default.altFlashBoneName);
|
||||
}
|
||||
if((SmokeEmitterClass != none) && ((SmokeEmitter == none) || SmokeEmitter.bDeleteMe))
|
||||
SmokeEmitter = Weapon.Spawn(SmokeEmitterClass);
|
||||
if((ShellEjectClass != none) && ((ShellEjectEmitter == none) || ShellEjectEmitter.bDeleteMe)){
|
||||
ShellEjectEmitter = Weapon.Spawn(ShellEjectClass);
|
||||
Weapon.AttachToBone(ShellEjectEmitter, ShellEjectBoneName);
|
||||
}
|
||||
if((ShellEjectClass != none) && ((ShellEject2Emitter == none) || ShellEject2Emitter.bDeleteMe)){
|
||||
ShellEject2Emitter = Weapon.Spawn(ShellEjectClass);
|
||||
Weapon.AttachToBone(ShellEject2Emitter, ShellEject2BoneName);
|
||||
}
|
||||
}
|
||||
simulated function DestroyEffects(){
|
||||
super.DestroyEffects();
|
||||
if(ShellEject2Emitter != none)
|
||||
ShellEject2Emitter.Destroy();
|
||||
if(Flash2Emitter != none)
|
||||
Flash2Emitter.Destroy();
|
||||
}
|
||||
function DrawMuzzleFlash(Canvas Canvas){
|
||||
super.DrawMuzzleFlash(Canvas);
|
||||
if(ShellEject2Emitter != none)
|
||||
Canvas.DrawActor( ShellEject2Emitter, false, false, Weapon.DisplayFOV );
|
||||
}
|
||||
function FlashMuzzleFlash(){
|
||||
if(Flash2Emitter == none || FlashEmitter == none)
|
||||
return;
|
||||
if(KFWeap.bAimingRifle){
|
||||
if(FireAimedAnim == 'FireLeft_Iron'){
|
||||
Flash2Emitter.Trigger(Weapon, Instigator);
|
||||
if(ShellEjectEmitter != none)
|
||||
ShellEjectEmitter.Trigger(Weapon, Instigator);
|
||||
}
|
||||
else{
|
||||
FlashEmitter.Trigger(Weapon, Instigator);
|
||||
if(ShellEject2Emitter != none)
|
||||
ShellEject2Emitter.Trigger(Weapon, Instigator);
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(FireAnim == 'FireLeft'){
|
||||
Flash2Emitter.Trigger(Weapon, Instigator);
|
||||
if(ShellEjectEmitter != none)
|
||||
ShellEjectEmitter.Trigger(Weapon, Instigator);
|
||||
}
|
||||
else{
|
||||
FlashEmitter.Trigger(Weapon, Instigator);
|
||||
if(ShellEject2Emitter != none)
|
||||
ShellEject2Emitter.Trigger(Weapon, Instigator);
|
||||
}
|
||||
}
|
||||
}
|
||||
simulated function ModeDoFireLeft(){
|
||||
local NiceDualies dualWeapon;
|
||||
local NiceDualiesAttachment dualAttach, dualAttachAlt;
|
||||
dualWeapon = NiceDualies(Weapon);
|
||||
dualAttach = NiceDualiesAttachment(dualWeapon.ThirdPersonActor);
|
||||
dualAttachAlt = NiceDualiesAttachment(dualWeapon.altThirdPersonActor);
|
||||
if(dualWeapon == none || !AllowLeftFire())
|
||||
return;
|
||||
// Set shine turn
|
||||
if(dualAttach != none)
|
||||
dualAttach.bMyFlashTurn = false;
|
||||
if(dualAttachAlt != none)
|
||||
dualAttachAlt.bMyFlashTurn = true;
|
||||
// Swap bones and animations
|
||||
dualWeapon.FlashBoneName = dualWeapon.default.altFlashBoneName;
|
||||
dualWeapon.altFlashBoneName = dualWeapon.default.FlashBoneName;
|
||||
FireAnim = default.FireAnim2;
|
||||
FireAnim2 = default.FireAnim;
|
||||
FireAimedAnim = default.FireAimedAnim2;
|
||||
FireAimedAnim2 = default.FireAimedAnim;
|
||||
// Do left shot
|
||||
bIsLeftShot = true;
|
||||
super.ModeDoFire();
|
||||
leftNextFireTime = UpdateNextFireTimeSingle(leftNextFireTime);
|
||||
InitEffects();
|
||||
bLastFiredLeft = true;
|
||||
}
|
||||
simulated function ModeDoFireRight(){
|
||||
local NiceDualies dualWeapon;
|
||||
local NiceDualiesAttachment dualAttach, dualAttachAlt;
|
||||
dualWeapon = NiceDualies(Weapon);
|
||||
dualAttach = NiceDualiesAttachment(dualWeapon.ThirdPersonActor);
|
||||
dualAttachAlt = NiceDualiesAttachment(dualWeapon.altThirdPersonActor);
|
||||
if(dualWeapon == none || !AllowRightFire())
|
||||
return;
|
||||
// Set shine turn
|
||||
if(dualAttach != none)
|
||||
dualAttach.bMyFlashTurn = true;
|
||||
if(dualAttachAlt != none)
|
||||
dualAttachAlt.bMyFlashTurn = false;
|
||||
// Default bones and animations
|
||||
dualWeapon.FlashBoneName = dualWeapon.default.FlashBoneName;
|
||||
dualWeapon.altFlashBoneName = dualWeapon.default.altFlashBoneName;
|
||||
FireAnim = default.FireAnim;
|
||||
FireAnim2 = default.FireAnim2;
|
||||
FireAimedAnim = default.FireAimedAnim;
|
||||
FireAimedAnim2 = default.FireAimedAnim2;
|
||||
// Do right shot
|
||||
bIsLeftShot = false;
|
||||
super.ModeDoFire();
|
||||
rightNextFireTime = UpdateNextFireTimeSingle(rightNextFireTime);
|
||||
InitEffects();
|
||||
bLastFiredLeft = false;
|
||||
}
|
||||
simulated function bool AllowLeftFire(){
|
||||
local NiceDualies niceDualWeap;
|
||||
niceDualWeap = NiceDualies(currentContext.sourceWeapon);
|
||||
if(niceDualWeap == none)
|
||||
return false;
|
||||
if(niceDualWeap.GetMagazineAmmoLeft() < default.AmmoPerFire && !bCanFireIncomplete)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
simulated function bool AllowRightFire(){
|
||||
local NiceDualies niceDualWeap;
|
||||
niceDualWeap = NiceDualies(currentContext.sourceWeapon);
|
||||
if(niceDualWeap == none)
|
||||
return false;
|
||||
if(niceDualWeap.GetMagazineAmmoRight() < default.AmmoPerFire && !bCanFireIncomplete)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
simulated function bool AllowFire(){
|
||||
return super.AllowFire() && (AllowLeftFire() || AllowRightFire());
|
||||
}
|
||||
event ModeDoFire(){
|
||||
local NiceDualies dualWeap;
|
||||
dualWeap = NiceDualies(Instigator.Weapon);
|
||||
if(dualWeap == none || niceNextFireTime > Level.TimeSeconds || !AllowFire())
|
||||
return;
|
||||
if(niceNextFireTime + FireRate < Level.TimeSeconds)
|
||||
bResetRecoil = true;
|
||||
// Choose correct pistol to fire
|
||||
if(Level.TimeSeconds > leftNextFireTime && Level.TimeSeconds > rightNextFireTime && AllowLeftFire() && AllowRightFire()){
|
||||
if(dualWeap.GetMagazineAmmoLeft() > dualWeap.GetMagazineAmmoRight())
|
||||
ModeDoFireLeft();
|
||||
else if(dualWeap.GetMagazineAmmoLeft() < dualWeap.GetMagazineAmmoRight())
|
||||
ModeDoFireRight();
|
||||
else if(bLastFiredLeft)
|
||||
ModeDoFireRight();
|
||||
else
|
||||
ModeDoFireLeft();
|
||||
}
|
||||
else if(Level.TimeSeconds > leftNextFireTime && AllowLeftFire())
|
||||
ModeDoFireLeft();
|
||||
else if(Level.TimeSeconds > rightNextFireTime && AllowRightFire())
|
||||
ModeDoFireRight();
|
||||
}
|
||||
simulated function ReduceAmmoClient(){
|
||||
local NiceDualies dualWeap;
|
||||
dualWeap = NiceDualies(currentContext.sourceWeapon);
|
||||
if(dualWeap == none)
|
||||
return;
|
||||
if(bIsLeftShot)
|
||||
dualWeap.MagAmmoRemLeftClient -= Load;
|
||||
else
|
||||
dualWeap.MagAmmoRemRightClient -= Load;
|
||||
if(dualWeap.MagAmmoRemLeftClient < 0)
|
||||
dualWeap.MagAmmoRemLeftClient = 0;
|
||||
if(dualWeap.MagAmmoRemRightClient < 0)
|
||||
dualWeap.MagAmmoRemRightClient = 0;
|
||||
// Force server's magazine size
|
||||
dualWeap.ServerReduceDualMag(dualWeap.MagAmmoRemLeftClient, dualWeap.MagAmmoRemRightClient, Level.TimeSeconds, ThisModeNum);
|
||||
}
|
||||
simulated function float UpdateNextFireTimeSingle(float fireTimeVar){
|
||||
FireRate *= 2;
|
||||
fireTimeVar = UpdateNextFireTime(fireTimeVar);
|
||||
FireRate = default.FireRate;
|
||||
return fireTimeVar;
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
ShellEject2BoneName="Shell_eject_right"
|
||||
FireAnim2="FireLeft"
|
||||
FireAimedAnim2="FireLeft_Iron"
|
||||
FireAimedAnim="FireRight_Iron"
|
||||
RecoilRate=0.070000
|
||||
maxVerticalRecoilAngle=450
|
||||
maxHorizontalRecoilAngle=50
|
||||
ShellEjectClass=Class'ROEffects.KFShellEject9mm'
|
||||
ShellEjectBoneName="Shell_eject_left"
|
||||
DamageMin=35
|
||||
DamageMax=35
|
||||
Momentum=10500.000000
|
||||
bPawnRapidFireAnim=True
|
||||
bWaitForRelease=True
|
||||
bAttachSmokeEmitter=True
|
||||
TransientSoundVolume=1.800000
|
||||
FireAnim="FireRight"
|
||||
FireLoopAnim=
|
||||
FireEndAnim=
|
||||
TweenTime=0.025000
|
||||
FireForce="AssaultRifleFire"
|
||||
FireRate=0.087500
|
||||
AmmoClass=Class'NicePack.NiceSingleAmmo'
|
||||
ShakeRotMag=(X=75.000000,Y=75.000000,Z=250.000000)
|
||||
ShakeRotRate=(X=10000.000000,Y=10000.000000,Z=10000.000000)
|
||||
ShakeRotTime=3.000000
|
||||
ShakeOffsetMag=(X=6.000000,Y=3.000000,Z=10.000000)
|
||||
ShakeOffsetRate=(X=1000.000000,Y=1000.000000,Z=1000.000000)
|
||||
ShakeOffsetTime=2.000000
|
||||
BotRefireRate=0.250000
|
||||
FlashEmitterClass=Class'ROEffects.MuzzleFlash1stMP'
|
||||
aimerror=30.000000
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
class NiceDualiesPickup extends NiceWeaponPickup;
|
||||
var int MagAmmoRemLeft;
|
||||
var int MagAmmoRemRight;
|
||||
function ShowDualiesInfo(Canvas C){
|
||||
C.SetPos((C.SizeX - C.SizeY) / 2,0);
|
||||
C.DrawTile( Texture'KillingfloorHUD.ClassMenu.Dualies', C.SizeY, C.SizeY, 0.0, 0.0, 256, 256);
|
||||
}
|
||||
function InitDroppedPickupFor(Inventory Inv){
|
||||
local NiceDualies dualW;
|
||||
super.InitDroppedPickupFor(Inv);
|
||||
dualW = NiceDualies(Inv);
|
||||
if(dualW != none){
|
||||
MagAmmoRemLeft = dualW.MagAmmoRemLeft;
|
||||
MagAmmoRemRight = dualW.MagAmmoRemRight;
|
||||
}
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
Weight=1.000000
|
||||
cost=150
|
||||
BuyClipSize=30
|
||||
PowerValue=35
|
||||
SpeedValue=85
|
||||
RangeValue=35
|
||||
Description="A pair of custom 9mm handguns."
|
||||
ItemName="Dual 9mms"
|
||||
ItemShortName="Dual 9mms"
|
||||
AmmoItemName="9mm Rounds"
|
||||
AmmoMesh=StaticMesh'KillingFloorStatics.DualiesAmmo'
|
||||
CorrespondingPerkIndex=2
|
||||
EquipmentCategoryID=1
|
||||
InventoryType=Class'NicePack.NiceDualies'
|
||||
PickupMessage="You found another 9mm handgun"
|
||||
PickupForce="AssaultRiflePickup"
|
||||
StaticMesh=StaticMesh'KF_pickups_Trip.pistol.double9mm_pickup'
|
||||
CollisionHeight=5.000000
|
||||
}
|
||||
215
sources/Weapons/BaseWeaponClasses/Pistols/NiceSingle.uc
Normal file
215
sources/Weapons/BaseWeaponClasses/Pistols/NiceSingle.uc
Normal file
|
|
@ -0,0 +1,215 @@
|
|||
class NiceSingle extends NiceWeapon;
|
||||
var bool bIsDual;
|
||||
var int otherMagazine;
|
||||
var class<NiceDualies> DualClass;
|
||||
replication{
|
||||
reliable if(Role < ROLE_Authority)
|
||||
ServerSwitchToOtherSingle, ServerSwitchToDual;
|
||||
reliable if(Role == ROLE_Authority)
|
||||
bIsDual, otherMagazine;
|
||||
}
|
||||
function bool HandlePickupQuery(Pickup Item){
|
||||
local float AddWeight;
|
||||
if(Item.InventoryType == class){
|
||||
AddWeight = Weight;
|
||||
if(DualClass != none)
|
||||
AddWeight = dualClass.default.Weight - AddWeight;
|
||||
if(bIsDual || KFHumanPawn(Owner) != none && !KFHumanPawn(Owner).CanCarry(AddWeight)){
|
||||
PlayerController(Instigator.Controller).ReceiveLocalizedMessage(Class'KFMainMessages', 2);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return super.HandlePickupQuery(Item);
|
||||
}
|
||||
simulated function bool AltFireCanForceInterruptReload(){
|
||||
return true;
|
||||
}
|
||||
simulated function Fire(float F){
|
||||
if(!bIsReloading && GetMagazineAmmo() <= 0 && otherMagazine > 0)
|
||||
ServerSwitchToOtherSingle();
|
||||
else
|
||||
super.Fire(F);
|
||||
}
|
||||
simulated function AltFire(float F){
|
||||
if(bIsDual && NicePlayerController(Instigator.Controller) != none)
|
||||
ClientForceInterruptReload(CANCEL_PASSIVESWITCH);
|
||||
if(!bIsReloading && bIsDual)
|
||||
ServerSwitchToDual();
|
||||
else
|
||||
super.AltFire(F);
|
||||
}
|
||||
function ServerSwitchToOtherSingle(){
|
||||
local int swap;
|
||||
local NiceHumanPawn nicePawn;
|
||||
nicePawn = NiceHumanPawn(Instigator);
|
||||
if(!bIsDual || nicePawn == none || nicePawn.Health <= 0)
|
||||
return;
|
||||
Ammo[0].AmmoAmount += otherMagazine - MagAmmoRemaining;
|
||||
swap = MagAmmoRemaining;
|
||||
MagAmmoRemaining = otherMagazine;
|
||||
otherMagazine = swap;
|
||||
ClientSetMagSize(MagAmmoRemaining, bRoundInChamber);
|
||||
//nicePawn.ClientChangeWeapon(self);
|
||||
}
|
||||
function ServerSwitchToDual(){
|
||||
local int m;
|
||||
local int origAmmo;
|
||||
local NiceHumanPawn nicePawn;
|
||||
local NiceDualies dualPistols;
|
||||
local NicePlainData.Data transferData;
|
||||
nicePawn = NiceHumanPawn(Instigator);
|
||||
if(!bIsDual || DualClass == none || nicePawn == none || nicePawn.Health <= 0)
|
||||
return;
|
||||
nicePawn.CurrentWeight -= Weight;
|
||||
Weight = 0;
|
||||
origAmmo = AmmoAmount(0);
|
||||
for(m = 0; m < NUM_FIRE_MODES;m ++)
|
||||
if(FireMode[m].bIsFiring)
|
||||
StopFire(m);
|
||||
DetachFromPawn(nicePawn);
|
||||
dualPistols = nicePawn.Spawn(DualClass);
|
||||
if(dualPistols != none){
|
||||
dualPistols.DemoReplacement = class;
|
||||
transferData = GetNiceData();
|
||||
dualPistols.GiveTo(nicePawn);
|
||||
dualPistols.SetNiceData(transferData, nicePawn);
|
||||
dualPistols.MagAmmoRemRight = MagAmmoRemaining;
|
||||
dualPistols.MagAmmoRemLeft = otherMagazine;
|
||||
dualPistols.MagAmmoRemaining = dualPistols.MagAmmoRemLeft + dualPistols.MagAmmoRemRight;
|
||||
dualPistols.SellValue = SellValue;
|
||||
dualPistols.Ammo[0].AmmoAmount = origAmmo + otherMagazine;
|
||||
dualPistols.ClientSetDualMagSize(dualPistols.MagAmmoRemLeft, dualPistols.MagAmmoRemRight);
|
||||
//nicePawn.ClientChangeWeapon(dualPistols);
|
||||
//nicePawn.ServerChangedWeapon(self, dualPistols);
|
||||
}
|
||||
Destroy();
|
||||
}
|
||||
function DropFrom(vector StartLocation){
|
||||
local int m;
|
||||
local int magKeep, magGive;
|
||||
local KFWeaponPickup weapPickup;
|
||||
local int weightBeforeThrow;
|
||||
local int AmmoThrown, OtherAmmo;
|
||||
local NiceHumanPawn nicePawn;
|
||||
nicePawn = NiceHumanPawn(Instigator);
|
||||
if(nicePawn == none)
|
||||
return;
|
||||
if(!bIsDual){
|
||||
super.DropFrom(StartLocation);
|
||||
return;
|
||||
}
|
||||
weightBeforeThrow = nicePawn.CurrentWeight;
|
||||
magKeep = otherMagazine;
|
||||
magGive = MagAmmoRemaining;
|
||||
OtherAmmo = AmmoAmount(0) - magKeep;
|
||||
ClientWeaponThrown();
|
||||
for(m = 0; m < NUM_FIRE_MODES;m ++)
|
||||
if(FireMode[m].bIsFiring)
|
||||
StopFire(m);
|
||||
if(nicePawn != none)
|
||||
DetachFromPawn(nicePawn);
|
||||
AmmoThrown = OtherAmmo / 2;
|
||||
OtherAmmo = OtherAmmo - AmmoThrown;
|
||||
Ammo[0].AmmoAmount = OtherAmmo + magKeep;
|
||||
MagAmmoRemaining = magKeep;
|
||||
ClientSetMagSize(MagAmmoRemaining, bRoundInChamber);
|
||||
weapPickup = KFWeaponPickup(nicePawn.Spawn(default.PickupClass,,, StartLocation));
|
||||
if(weapPickup != none){
|
||||
weapPickup.InitDroppedPickupFor(self);
|
||||
weapPickup.Velocity = Velocity;
|
||||
weapPickup.AmmoAmount[0] = AmmoThrown + magGive;
|
||||
weapPickup.SellValue = SellValue * 0.5;
|
||||
SellValue *= 0.5;
|
||||
weapPickup.MagAmmoRemaining = magGive;
|
||||
if(nicePawn.Health > 0)
|
||||
weapPickup.bThrown = true;
|
||||
nicePawn.ClientChangeWeapon(self);
|
||||
}
|
||||
RemoveDual(weightBeforeThrow);
|
||||
}
|
||||
function RemoveDual(int pawnWeight){
|
||||
local NiceHumanPawn nicePawn;
|
||||
nicePawn = NiceHumanPawn(Instigator);
|
||||
if(!bIsDual || nicePawn == none)
|
||||
return;
|
||||
bIsDual = false;
|
||||
DemoReplacement = none;
|
||||
nicePawn.CurrentWeight = pawnWeight - (Weight - default.Weight);
|
||||
Weight = default.Weight;
|
||||
otherMagazine = 0;
|
||||
}
|
||||
//SellValue
|
||||
function GiveTo(Pawn other, optional Pickup Pickup){
|
||||
local int m;
|
||||
local int initAmmo, initMag;
|
||||
local bool bDestroy;
|
||||
local NiceSingle nicePistol;
|
||||
local NiceDualies niceDual;
|
||||
if(other != none){
|
||||
nicePistol = NiceSingle(other.FindInventoryType(class));
|
||||
niceDual = NiceDualies(other.FindInventoryType(DualClass));
|
||||
}
|
||||
bDestroy = false;
|
||||
if(nicePistol == none || (niceDual != none && niceDual.bSwitching))
|
||||
super.GiveTo(other, Pickup);
|
||||
else if((nicePistol != none && nicePistol.bIsDual) || niceDual != none)
|
||||
bDestroy = true;
|
||||
else{
|
||||
nicePistol.UpdateMagCapacity(other.PlayerReplicationInfo);
|
||||
initAmmo = nicePistol.FireMode[0].AmmoClass.default.InitialAmount;
|
||||
initMag = nicePistol.MagCapacity;
|
||||
initMag = Min(initMag, initAmmo);
|
||||
initAmmo -= initMag;
|
||||
if(nicePistol.Ammo[0] != none){
|
||||
nicePistol.Ammo[0].AmmoAmount += initAmmo;
|
||||
nicePistol.Ammo[0].AmmoAmount = Min(nicePistol.Ammo[0].AmmoAmount, nicePistol.Ammo[0].MaxAmmo);
|
||||
}
|
||||
nicePistol.bIsDual = true;
|
||||
nicePistol.otherMagazine = initMag;
|
||||
nicePistol.SellValue = 2 * min(SellValue, nicePistol.SellValue);
|
||||
nicePistol.ServerSwitchToDual();
|
||||
bDestroy = true;
|
||||
}
|
||||
if(bDestroy){
|
||||
for(m = 0; m < NUM_FIRE_MODES;m ++)
|
||||
Ammo[m] = none;
|
||||
Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
DualClass=Class'NicePack.NiceDualies'
|
||||
bHasChargePhase=False
|
||||
FirstPersonFlashlightOffset=(X=-20.000000,Y=-22.000000,Z=8.000000)
|
||||
MagCapacity=15
|
||||
ReloadRate=2.000000
|
||||
ReloadAnim="Reload"
|
||||
ReloadAnimRate=1.000000
|
||||
WeaponReloadAnim="Reload_Single9mm"
|
||||
ModeSwitchAnim="LightOn"
|
||||
Weight=0.000000
|
||||
bHasAimingMode=True
|
||||
IdleAimAnim="Idle_Iron"
|
||||
StandardDisplayFOV=70.000000
|
||||
TraderInfoTexture=Texture'KillingFloorHUD.Trader_Weapon_Images.Trader_9mm'
|
||||
ZoomedDisplayFOV=65.000000
|
||||
FireModeClass(0)=Class'NicePack.NiceSingleFire'
|
||||
FireModeClass(1)=Class'KFMod.NoFire'
|
||||
PutDownAnim="PutDown"
|
||||
AIRating=0.250000
|
||||
CurrentRating=0.250000
|
||||
bShowChargingBar=True
|
||||
Description="A 9mm Pistol"
|
||||
DisplayFOV=70.000000
|
||||
Priority=60
|
||||
InventoryGroup=2
|
||||
GroupOffset=1
|
||||
PickupClass=Class'NicePack.NiceSinglePickup'
|
||||
PlayerViewOffset=(X=20.000000,Y=25.000000,Z=-10.000000)
|
||||
BobDamping=6.000000
|
||||
AttachmentClass=Class'NicePack.NiceSingleAttachment'
|
||||
IconCoords=(X1=434,Y1=253,X2=506,Y2=292)
|
||||
ItemName="Just a single pistol"
|
||||
}
|
||||
13
sources/Weapons/BaseWeaponClasses/Pistols/NiceSingleAmmo.uc
Normal file
13
sources/Weapons/BaseWeaponClasses/Pistols/NiceSingleAmmo.uc
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
class NiceSingleAmmo extends NiceAmmo;
|
||||
#EXEC OBJ LOAD FILE=InterfaceContent.utx
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
AmmoPickupAmount=30
|
||||
MaxAmmo=240
|
||||
InitialAmount=120
|
||||
PickupClass=Class'KFMod.SingleAmmoPickup'
|
||||
IconMaterial=Texture'KillingFloorHUD.Generic.HUD'
|
||||
IconCoords=(X1=413,Y1=82,X2=457,Y2=125)
|
||||
ItemName="9mm bullets"
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
class NiceSingleAmmoPickup extends NiceAmmoPickup;
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
AmmoAmount=20
|
||||
InventoryType=Class'NicePack.NiceSingleAmmo'
|
||||
RespawnTime=0.000000
|
||||
PickupMessage="Rounds (9mm)"
|
||||
StaticMesh=StaticMesh'KillingFloorStatics.DualiesAmmo'
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
class NiceSingleAttachment extends NiceAttachment;
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
mMuzFlashClass=Class'ROEffects.MuzzleFlash3rdPistol'
|
||||
mTracerClass=Class'KFMod.KFNewTracer'
|
||||
mShellCaseEmitterClass=Class'KFMod.KFShellSpewer'
|
||||
MovementAnims(0)="JogF_Single9mm"
|
||||
MovementAnims(1)="JogB_Single9mm"
|
||||
MovementAnims(2)="JogL_Single9mm"
|
||||
MovementAnims(3)="JogR_Single9mm"
|
||||
TurnLeftAnim="TurnL_Single9mm"
|
||||
TurnRightAnim="TurnR_Single9mm"
|
||||
CrouchAnims(0)="CHwalkF_Single9mm"
|
||||
CrouchAnims(1)="CHwalkB_Single9mm"
|
||||
CrouchAnims(2)="CHwalkL_Single9mm"
|
||||
CrouchAnims(3)="CHwalkR_Single9mm"
|
||||
CrouchTurnRightAnim="CH_TurnR_Single9mm"
|
||||
CrouchTurnLeftAnim="CH_TurnL_Single9mm"
|
||||
IdleCrouchAnim="CHIdle_Single9mm"
|
||||
IdleWeaponAnim="Idle_Single9mm"
|
||||
IdleRestAnim="Idle_Single9mm"
|
||||
IdleChatAnim="Idle_Single9mm"
|
||||
IdleHeavyAnim="Idle_Single9mm"
|
||||
IdleRifleAnim="Idle_Single9mm"
|
||||
FireAnims(0)="Fire_Single9mm"
|
||||
FireAnims(1)="Fire_Single9mm"
|
||||
FireAnims(2)="Fire_Single9mm"
|
||||
FireAnims(3)="Fire_Single9mm"
|
||||
FireAltAnims(0)="Fire_Single9mm"
|
||||
FireAltAnims(1)="Fire_Single9mm"
|
||||
FireAltAnims(2)="Fire_Single9mm"
|
||||
FireAltAnims(3)="Fire_Single9mm"
|
||||
FireCrouchAnims(0)="CHFire_Single9mm"
|
||||
FireCrouchAnims(1)="CHFire_Single9mm"
|
||||
FireCrouchAnims(2)="CHFire_Single9mm"
|
||||
FireCrouchAnims(3)="CHFire_Single9mm"
|
||||
FireCrouchAltAnims(0)="CHFire_Single9mm"
|
||||
FireCrouchAltAnims(1)="CHFire_Single9mm"
|
||||
FireCrouchAltAnims(2)="CHFire_Single9mm"
|
||||
FireCrouchAltAnims(3)="CHFire_Single9mm"
|
||||
HitAnims(0)="HitF_Single9mm"
|
||||
HitAnims(1)="HitB_Single9mm"
|
||||
HitAnims(2)="HitL_Single9mm"
|
||||
HitAnims(3)="HitR_Single9mm"
|
||||
PostFireBlendStandAnim="Blend_Single9mm"
|
||||
PostFireBlendCrouchAnim="CHBlend_Single9mm"
|
||||
SplashEffect=Class'ROEffects.BulletSplashEmitter'
|
||||
LightType=LT_Pulse
|
||||
LightRadius=0.000000
|
||||
CullDistance=5000.000000
|
||||
}
|
||||
46
sources/Weapons/BaseWeaponClasses/Pistols/NiceSingleFire.uc
Normal file
46
sources/Weapons/BaseWeaponClasses/Pistols/NiceSingleFire.uc
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
class NiceSingleFire extends NiceFire;
|
||||
var bool bWasInZedTime;
|
||||
simulated function ModeTick(float delta){
|
||||
local NicePlayerController nicePlayer;
|
||||
if(instigator != none)
|
||||
nicePlayer = NicePlayerController(instigator.controller);
|
||||
if(nicePlayer != none && nicePlayer.IsZedTimeActive() != bWasInZedTime){
|
||||
bWasInZedTime = !bWasInZedTime;
|
||||
if(bWasInZedTime)
|
||||
niceNextFireTime = Level.TimeSeconds + (niceNextFireTime - Level.TimeSeconds) * KFGameType(Level.Game).ZedTimeSlomoScale;
|
||||
nextFireTime = niceNextFireTime;
|
||||
}
|
||||
super.ModeTick(delta);
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
FireAimedAnim="Fire_Iron"
|
||||
RecoilRate=0.070000
|
||||
maxVerticalRecoilAngle=300
|
||||
maxHorizontalRecoilAngle=50
|
||||
ShellEjectClass=Class'ROEffects.KFShellEject9mm'
|
||||
ShellEjectBoneName="Shell_eject"
|
||||
bRandomPitchFireSound=False
|
||||
DamageMin=35
|
||||
DamageMax=35
|
||||
Momentum=10000.000000
|
||||
bPawnRapidFireAnim=True
|
||||
bWaitForRelease=True
|
||||
bAttachSmokeEmitter=True
|
||||
TransientSoundVolume=1.800000
|
||||
FireAnimRate=1.500000
|
||||
TweenTime=0.025000
|
||||
FireForce="AssaultRifleFire"
|
||||
FireRate=0.175000
|
||||
AmmoClass=Class'NicePack.NiceSingleAmmo'
|
||||
ShakeRotMag=(X=75.000000,Y=75.000000,Z=250.000000)
|
||||
ShakeRotRate=(X=10000.000000,Y=10000.000000,Z=10000.000000)
|
||||
ShakeRotTime=3.000000
|
||||
ShakeOffsetMag=(X=6.000000,Y=3.000000,Z=10.000000)
|
||||
ShakeOffsetRate=(X=1000.000000,Y=1000.000000,Z=1000.000000)
|
||||
ShakeOffsetTime=2.000000
|
||||
BotRefireRate=0.350000
|
||||
FlashEmitterClass=Class'ROEffects.MuzzleFlash1stMP'
|
||||
aimerror=30.000000
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
class NiceSinglePickup extends NiceWeaponPickup;
|
||||
function Inventory SpawnCopy(Pawn other){
|
||||
local Inventory CurInv;
|
||||
local NiceWeapon PistolInInventory;
|
||||
for(CurInv = other.Inventory;CurInv != none;CurInv = CurInv.Inventory){
|
||||
PistolInInventory = NiceWeapon(CurInv);
|
||||
if(PistolInInventory != none && PistolInInventory.class == default.InventoryType){
|
||||
// Make dualies to cost twice of lowest value in case of PERKED+UNPERKED pistols
|
||||
SellValue = 2 * min(SellValue, PistolInInventory.SellValue);
|
||||
AmmoAmount[0] += PistolInInventory.AmmoAmount(0);
|
||||
class'NicePlainData'.static.SetInt(weaponData, "leftMag", MagAmmoRemaining);
|
||||
class'NicePlainData'.static.SetInt(weaponData, "rightMag", PistolInInventory.MagAmmoRemaining);
|
||||
// destroy the inventory to force parent SpawnCopy() to make a new instance of class
|
||||
// we specified below
|
||||
if(Inventory != none)
|
||||
Inventory.Destroy();
|
||||
// spawn dual guns instead of another instance of single
|
||||
if(class<NiceSingle>(default.InventoryType) != none)
|
||||
InventoryType = class<NiceSingle>(default.InventoryType).default.DualClass;
|
||||
if(CurInv != none){
|
||||
CurInv.Destroyed();
|
||||
CurInv.Destroy();
|
||||
}
|
||||
return super(KFWeaponPickup).SpawnCopy(other);
|
||||
}
|
||||
}
|
||||
InventoryType = default.InventoryType;
|
||||
return super(KFWeaponPickup).SpawnCopy(other);
|
||||
}
|
||||
function bool CheckCanCarry(KFHumanPawn Hm){
|
||||
local Inventory CurInv;
|
||||
local class<NiceWeapon> dualClass;
|
||||
local float AddWeight;
|
||||
AddWeight = class<KFWeapon>(default.InventoryType).default.Weight;
|
||||
if(class<NiceWeapon>(default.InventoryType) != none)
|
||||
dualClass = class<NiceSingle>(default.InventoryType).default.dualClass;
|
||||
for(CurInv = Hm.Inventory; CurInv != none; CurInv = CurInv.Inventory){
|
||||
if(CurInv.class == dualClass) {
|
||||
// Already have duals, can't carry a single
|
||||
if(LastCantCarryTime < Level.TimeSeconds && PlayerController(Hm.Controller) != none){
|
||||
LastCantCarryTime = Level.TimeSeconds + 0.5;
|
||||
PlayerController(Hm.Controller).ReceiveLocalizedMessage(Class'KFMainMessages', 2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if(CurInv.class == default.InventoryType && dualClass != none){
|
||||
AddWeight = dualClass.default.Weight - AddWeight;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!Hm.CanCarry(AddWeight)){
|
||||
if(LastCantCarryTime < Level.TimeSeconds && PlayerController(Hm.Controller) != none){
|
||||
LastCantCarryTime = Level.TimeSeconds + 0.5;
|
||||
PlayerController(Hm.Controller).ReceiveLocalizedMessage(Class'KFMainMessages', 2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
Weight=0.000000
|
||||
cost=150
|
||||
AmmoCost=10
|
||||
BuyClipSize=30
|
||||
PowerValue=20
|
||||
SpeedValue=50
|
||||
RangeValue=35
|
||||
Description="A 9mm handgun."
|
||||
ItemName="!!!"
|
||||
ItemShortName="!!!"
|
||||
AmmoItemName="9mm Rounds"
|
||||
AmmoMesh=StaticMesh'KillingFloorStatics.DualiesAmmo'
|
||||
CorrespondingPerkIndex=2
|
||||
EquipmentCategoryID=1
|
||||
InventoryType=Class'NicePack.NiceSingle'
|
||||
PickupMessage="You got the 9mm handgun"
|
||||
PickupSound=Sound'KF_9MMSnd.9mm_Pickup'
|
||||
PickupForce="AssaultRiflePickup"
|
||||
StaticMesh=StaticMesh'KF_pickups_Trip.pistol.9mm_Pickup'
|
||||
CollisionHeight=5.000000
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue