KF2-Server-Extension/ServerExt/Classes/ExtPawn_Customization.uc

108 lines
3.0 KiB
Ucode
Raw Normal View History

2017-10-20 02:00:49 +00:00
class ExtPawn_Customization extends KFPawn_Customization;
simulated function KFCharacterInfoBase GetCharacterInfo()
{
2020-11-28 20:12:58 +00:00
if (ExtPlayerReplicationInfo(PlayerReplicationInfo)!=None)
2017-10-20 02:00:49 +00:00
return ExtPlayerReplicationInfo(PlayerReplicationInfo).GetSelectedArch();
return Super.GetCharacterInfo();
}
2020-11-28 20:04:55 +00:00
simulated function SetCharacterArch(KFCharacterInfoBase Info, optional bool bForce)
2017-10-20 02:00:49 +00:00
{
local KFPlayerReplicationInfo KFPRI;
2020-11-28 20:04:55 +00:00
KFPRI = KFPlayerReplicationInfo(PlayerReplicationInfo);
2017-10-20 02:00:49 +00:00
if (Info != CharacterArch || bForce)
{
// Set Family Info
CharacterArch = Info;
2020-11-28 20:04:55 +00:00
CharacterArch.SetCharacterFromArch(self, KFPRI);
class'ExtCharacterInfo'.Static.SetCharacterMeshFromArch(KFCharacterInfo_Human(CharacterArch), self, KFPRI);
class'ExtCharacterInfo'.Static.SetFirstPersonArmsFromArch(KFCharacterInfo_Human(CharacterArch), self, KFPRI);
2017-10-20 02:00:49 +00:00
SetCharacterAnimationInfo();
// Sounds
SoundGroupArch = Info.SoundGroupArch;
if (WorldInfo.NetMode != NM_DedicatedServer)
{
// refresh weapon attachment (attachment bone may have changed)
if (WeaponAttachmentTemplate != None)
{
WeaponAttachmentChanged(true);
}
}
}
2020-11-28 20:12:58 +00:00
if (CharacterArch != none)
2017-10-20 02:00:49 +00:00
{
2020-11-28 20:12:58 +00:00
if (CharacterArch.VoiceGroupArchName != "")
2017-10-20 02:00:49 +00:00
VoiceGroupArch = class<KFPawnVoiceGroup>(class'ExtCharacterInfo'.Static.SafeLoadObject(CharacterArch.VoiceGroupArchName, class'Class'));
}
}
function bool Died(Controller Killer, class<DamageType> DamageType, vector HitLocation)
{
// Destroy this pawn if player leaves.
Destroy();
return true;
}
simulated function PlayEmoteAnimation(optional bool bNewCharacter)
{
local name AnimName;
local float BlendInTime;
2020-11-28 20:04:55 +00:00
AnimName = class'ExtEmoteList'.static.GetUnlockedEmote(class'ExtEmoteList'.static.GetEquippedEmoteId(ExtPlayerController(Controller)), ExtPlayerController(Controller));
BlendInTime = (bNewCharacter) ? 0.f : 0.4;
// Briefly turn off notify so that PlayCustomAnim won't call OnAnimEnd (e.g. character swap)
2020-11-28 20:04:55 +00:00
BodyStanceNodes[EAS_FullBody].SetActorAnimEndNotification(FALSE);
BodyStanceNodes[EAS_FullBody].PlayCustomAnim(AnimName, 1.f, BlendInTime, 0.4, false, true);
2020-11-28 20:04:55 +00:00
BodyStanceNodes[EAS_FullBody].SetActorAnimEndNotification(TRUE);
}
2020-11-28 20:04:55 +00:00
function AttachWeaponByItemDefinition(int ItemDefinition)
{
local class<KFWeaponDefinition> WeaponDef;
local int ItemINdex;
local KFWeaponAttachment WeaponPreview;
//find weapon def
ItemIndex = class'ExtWeaponSkinList'.default.Skins.Find('Id', ItemDefinition);
2020-11-28 20:12:58 +00:00
if (ItemIndex == INDEX_NONE)
{
`log("Could not find item" @ItemDefinition);
return;
}
WeaponDef = class'ExtWeaponSkinList'.default.Skins[ItemIndex].WeaponDef;
2020-11-28 20:12:58 +00:00
if (WeaponDef == none)
{
`log("Weapon def NONE for : " @ItemDefinition);
return;
}
//load in and add object .
2020-11-28 20:04:55 +00:00
WeaponPreview = KFWeaponAttachment (DynamicLoadObject(WeaponDef.default.AttachmentArchtypePath, class'KFWeaponAttachment'));
//attatch it to player
WeaponAttachmentTemplate = WeaponPreview;
WeaponAttachmentChanged();
//setweapon skin
WeaponAttachment.SetWeaponSkin(ItemDefinition);
}
2017-10-20 02:00:49 +00:00
defaultproperties
{
bCollideActors=false
bBlockActors=false
}