Dayz 1.25
Dayz Code Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл WeaponChambering.c

См. исходные тексты.

Структуры данных

class  WeaponStartAction
 simple class starting animation action specified by m_action and m_actionType Подробнее...
 
class  WeaponStateBase
 represent weapon state base Подробнее...
 
class  WeaponChambering_Base
 
class  WeaponChambering_Cartridge
 

Функции

override void OnExit (WeaponEventBase e)
 
override void OnEntry (WeaponEventBase e)
 
void ChamberMultiBullet (Weapon_Base w=NULL, WeaponStateBase parent=NULL, WeaponActions action=WeaponActions.NONE, int startActionType=-1, int endActionType=-1)
 
override void OnAbort (WeaponEventBase e)
 
override bool SaveCurrentFSMState (ParamsWriteContext ctx)
 
override bool LoadCurrentFSMState (ParamsReadContext ctx, int version)
 

Переменные

class WeaponChambering_Cartridge_InnerMag extends WeaponChambering_Base IsWaitingForActionFinish
 
class WeaponEndAction extends WeaponStartAction m_action
 
int m_startActionType
 
int m_endActionType
 
Magazine m_srcMagazine
 
ref InventoryLocation m_srcMagazinePrevLocation
 source of the cartridge
 
ref WeaponStateBase m_start
 
ref WeaponEjectCasingMultiMuzzle m_eject
 
ref WeaponChambering_Base m_chamber
 
ref WeaponChambering_Base m_chamber_end
 
ref LoopedChambering_Wait4ShowBullet2 m_w4sb2
 
ref WeaponEndAction m_endLoop
 
ref BulletShow_W4T m_showB
 
ref BulletShow2_W4T m_showB2
 

Функции

◆ ChamberMultiBullet()

void ChamberMultiBullet ( Weapon_Base w = NULL,
WeaponStateBase parent = NULL,
WeaponActions action = WeaponActions.NONE,
int startActionType = -1,
int endActionType = -1 )
647 {
651
652 // setup nested state machine
658 m_showB = new BulletShow_W4T(m_weapon, this);
660
661 m_endLoop = new WeaponEndAction(m_weapon, this, m_action, m_endActionType); // @NOTE: termination playing action - dummy?
662 // events
663 WeaponEventBase _fin_ = new WeaponEventHumanCommandActionFinished;
664 WeaponEventContinuousLoadBulletStart __lS_ = new WeaponEventContinuousLoadBulletStart;
665 WeaponEventContinuousLoadBulletEnd __lE_ = new WeaponEventContinuousLoadBulletEnd;
666 WeaponEventAnimBulletShow __bs_ = new WeaponEventAnimBulletShow;
667 WeaponEventAnimBulletShow2 _bs2_ = new WeaponEventAnimBulletShow2;
668 WeaponEventAnimBulletHide __bh_ = new WeaponEventAnimBulletHide;
669 WeaponEventAnimBulletEject __be_ = new WeaponEventAnimBulletEject;
670 WeaponEventAnimBulletInChamber __bc_ = new WeaponEventAnimBulletInChamber;
671
672 m_fsm = new WeaponFSM(this); // @NOTE: set owner of the submachine fsm
673 m_fsm.AddTransition(new WeaponTransition(m_start , __be_, m_eject));
674
675 m_fsm.AddTransition(new WeaponTransition(m_start , __bs_, m_chamber));
676 m_fsm.AddTransition(new WeaponTransition(m_eject , __bs_, m_chamber));
677
678 m_fsm.AddTransition(new WeaponTransition(m_chamber, __bc_, m_w4sb2, NULL, new GuardAnd(new GuardAnd(new WeaponGuardHasAmmoInLoopedState(m_chamber), new WeaponGuardChamberMultiHasRoomBulltet(m_weapon)),new WeaponGuardWeaponManagerWantContinue())));
679 m_fsm.AddTransition(new WeaponTransition(m_chamber, __bc_, m_endLoop));
680 m_fsm.AddTransition(new WeaponTransition(m_w4sb2, __bs_, m_chamber));
681
682 m_fsm.AddTransition(new WeaponTransition(m_w4sb2 , _fin_, NULL));
683 m_fsm.AddTransition(new WeaponTransition(m_chamber , _fin_, NULL));
684 m_fsm.AddTransition(new WeaponTransition(m_endLoop , _fin_, NULL));
685
686 // Safety exits
687 m_fsm.AddTransition(new WeaponTransition(m_eject , _fin_, null));
688 m_fsm.AddTransition(new WeaponTransition(m_start , _fin_, null));
689
690 m_fsm.SetInitialState(m_start);
691 }
class WeaponGuardIsDestroyed extends WeaponGuardBase m_weapon
Definition Guards.c:604
enum FSMTransition WeaponTransition
ref LoopedChambering_Wait4ShowBullet2 m_w4sb2
Definition WeaponChambering.c:641
ref BulletShow2_W4T m_showB2
Definition WeaponChambering.c:644
int m_startActionType
Definition WeaponChambering.c:632
int m_endActionType
Definition WeaponChambering.c:633
ref WeaponEndAction m_endLoop
Definition WeaponChambering.c:642
ref WeaponStateBase m_start
Definition WeaponChambering.c:637
class WeaponEndAction extends WeaponStartAction m_action
ref WeaponChambering_Base m_chamber
Definition WeaponChambering.c:639
ref WeaponChambering_Base m_chamber_end
Definition WeaponChambering.c:640
ref WeaponEjectCasingMultiMuzzle m_eject
Definition WeaponChambering.c:638
ref BulletShow_W4T m_showB
Definition WeaponChambering.c:643
Definition EntityAI.c:95
Definition WeaponEjectCasingAndChamberFromAttMag.c:52
signalize mechanism manipulation
Definition Events.c:35
weapon finite state machine

Перекрестные ссылки m_action, m_chamber, m_chamber_end, m_eject, m_endActionType, m_endLoop, m_showB, m_showB2, m_start, m_startActionType, m_w4sb2, m_weapon и WeaponStateBase::WeaponEjectCasingMultiMuzzle().

Используется в DoubleBarrel_Base::InitStateMachine().

◆ LoadCurrentFSMState()

override bool LoadCurrentFSMState ( ParamsReadContext ctx,
int version )
868 {
869 if (!super.LoadCurrentFSMState(ctx, version))
870 return false;
871
872 if (!ctx.Read(m_srcMagazine))
873 {
874 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet.LoadCurrentFSMState: cannot read m_srcMagazine for weapon=" + m_weapon);
875 return false;
876 }
877
879 {
880 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet.LoadCurrentFSMState: cannot read m_srcMagazinePrevLocation for weapon=" + m_weapon);
881 return false;
882 }
883 return true;
884 }
bool OptionalLocationReadFromContext(out InventoryLocation loc, notnull ParamsReadContext ctx)
Definition InventoryLocation.c:605
Magazine m_srcMagazine
Definition WeaponChambering.c:634
ref InventoryLocation m_srcMagazinePrevLocation
source of the cartridge
Definition WeaponChambering.c:635
Definition ObjectTyped.c:2
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90

Перекрестные ссылки Error(), m_srcMagazine, m_srcMagazinePrevLocation, m_weapon и OptionalLocationReadFromContext().

◆ OnAbort()

789 {
790 bool done = false;
791 if (m_srcMagazine)
792 {
793 e.m_player.GetInventory().ClearInventoryReservationEx( m_srcMagazine , m_srcMagazinePrevLocation );
794
796 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
797 if (leftHandIl.IsValid())
798 {
800 {
802 {
804 {
806 {
807 if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet, ok - ammo pile removed from left hand to previous location (LHand->inv) - abort"); }
808 done = true;
809 }
810 }
811 }
812 }
813
814 if( !done)
815 {
817 e.m_player.GetInventory().FindFreeLocationFor( m_srcMagazine, FindInventoryLocationType.CARGO, il );
818
819 if(!il || !il.IsValid())
820 {
821 if (DayZPlayerUtils.HandleDropMagazine(e.m_player, m_srcMagazine))
822 {
823 if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet, ok - no inventory space for ammo pile - dropped to ground - abort"); }
824 }
825 else
826 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - abort");
827
828 }
829 else
830 {
832 {
833 if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet, ok - ammo pile removed from left hand (LHand->inv) - abort"); }
834 }
835 else
836 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet, error - cannot remove ammo pile from wpn - abort");
837 }
838 }
839 }
840 }
841
842 super.OnAbort(e);
844 m_chamber.m_srcMagazine = NULL;
846 }
void wpnDebugPrint(string s)
Definition Debug.c:9
void DayZPlayerUtils()
cannot be instantiated
Definition DayZPlayerUtils.c:461
FindInventoryLocationType
flags for searching locations in inventory
Definition InventoryLocation.c:16
script counterpart to engine's class Inventory
Definition Inventory.c:79
static proto native bool LocationCanMoveEntity(notnull InventoryLocation src, notnull InventoryLocation dst)
queries if the entity contained in inv_loc.m_item can be moved to another location This is a shorthan...
static proto native bool LocationSyncMoveEntity(notnull InventoryLocation src_loc, notnull InventoryLocation dst_loc)
synchronously removes item from current inventory location and adds it to destination no anims involv...
InventoryLocation.
Definition InventoryLocation.c:28
Definition Debug.c:735
static bool IsWeaponLogEnable()
Definition Debug.c:859
Definition WeaponManager.c:2
const float MAX_DROP_MAGAZINE_DISTANCE_SQ
Definition WeaponManager.c:3
Definition EnConvert.c:106
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.

Перекрестные ссылки DayZPlayerUtils(), vector::DistanceSq(), Error(), LogManager::IsWeaponLogEnable(), GameInventory::LocationCanMoveEntity(), GameInventory::LocationSyncMoveEntity(), m_chamber, m_srcMagazine, m_srcMagazinePrevLocation, m_weapon, WeaponManager::MAX_DROP_MAGAZINE_DISTANCE_SQ и wpnDebugPrint().

◆ OnEntry()

192 {
193 super.OnEntry(e);
194
195 /*for(int i = 0; i < m_weapon.GetMuzzleCount(); i++ )
196 {
197 if(!m_weapon.IsChamberFull(i))
198 {
199 m_weapon.ShowBullet(i);
200 m_weapon.EffectBulletShow(i, m_damage, m_type);
201 return;
202 }
203 }*/
204 }

◆ OnExit()

192 {
193 super.OnEntry(e);
194
195 /*for(int i = 0; i < m_weapon.GetMuzzleCount(); i++ )
196 {
197 if(!m_weapon.IsChamberFull(i))
198 {
199 m_weapon.ShowBullet(i);
200 m_weapon.EffectBulletShow(i, m_damage, m_type);
201 return;
202 }
203 }*/
204 }
205
206 override void OnExit(WeaponEventBase e)
207 {
208 m_weapon.SelectionBulletHide();
209 int muzzle = m_weapon.GetCurrentMuzzle();
override void OnExit(WeaponEventBase e)
Definition WeaponChambering.c:191

◆ SaveCurrentFSMState()

override bool SaveCurrentFSMState ( ParamsWriteContext ctx)
849 {
850 if (!super.SaveCurrentFSMState(ctx))
851 return false;
852
853 if (!ctx.Write(m_srcMagazine))
854 {
855 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet.SaveCurrentFSMState: cannot save m_srcMagazine for weapon=" + m_weapon);
856 return false;
857 }
858
860 {
861 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet.SaveCurrentFSMState: cannot write m_srcMagazinePrevLocation for weapon=" + m_weapon);
862 return false;
863 }
864 return true;
865 }
bool OptionalLocationWriteToContext(InventoryLocation loc, notnull ParamsWriteContext ctx)
Definition InventoryLocation.c:583

Перекрестные ссылки Error(), m_srcMagazine, m_srcMagazinePrevLocation, m_weapon и OptionalLocationWriteToContext().

Переменные

◆ IsWaitingForActionFinish

override bool IsWaitingForActionFinish
190{ return false; }

◆ m_action

◆ m_chamber

◆ m_chamber_end

ref WeaponChambering_Base m_chamber_end

Используется в ChamberMultiBullet().

◆ m_eject

◆ m_endActionType

◆ m_endLoop

◆ m_showB

Используется в ChamberMultiBullet().

◆ m_showB2

ref BulletShow2_W4T m_showB2

Используется в ChamberMultiBullet().

◆ m_srcMagazine

◆ m_srcMagazinePrevLocation

◆ m_start

◆ m_startActionType

◆ m_w4sb2