DayZ 1.24
Loading...
Searching...
No Matches
Mp133Shotgun_Base Class Reference

basic mp5 submachine gun More...

Inheritance diagram for Mp133Shotgun_Base:
[legend]
Collaboration diagram for Mp133Shotgun_Base:
[legend]

Private Member Functions

void Mp133Shotgun ()
 
override RecoilBase SpawnRecoilObject ()
 
override void InitStateMachine ()
 
override bool CanChamberBullet (int muzzleIndex, Magazine mag)
 
override void SetActions ()
 
override void OnDebugSpawn ()
 

Private Attributes

ref WeaponStableState E
 
ref WeaponStableState F
 
ref WeaponStableState L
 
ref WeaponStableState J
 

Detailed Description

basic mp5 submachine gun

Definition at line 64 of file MP133.c.

Member Function Documentation

◆ CanChamberBullet()

override bool Mp133Shotgun_Base::CanChamberBullet ( int muzzleIndex,
Magazine mag )
inlineprivate

Definition at line 214 of file MP133.c.

215 {
216 return CanChamberFromMag(muzzleIndex, mag) && !IsInternalMagazineFull(muzzleIndex);
217 }

◆ InitStateMachine()

override void Mp133Shotgun_Base::InitStateMachine ( )
inlineprivate

Definition at line 80 of file MP133.c.

81 {
82 // setup abilities
83 m_abilities.Insert(new AbilityRecord(WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED));
84 m_abilities.Insert(new AbilityRecord(WeaponActions.UNJAMMING, WeaponActionUnjammingTypes.UNJAMMING_START));
85 m_abilities.Insert(new AbilityRecord(WeaponActions.UNJAMMING, WeaponActionUnjammingTypes.UNJAMMING_END));
86
87 m_abilities.Insert(new AbilityRecord(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_NORMAL));
88 m_abilities.Insert(new AbilityRecord(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_DRY));
89
90 m_abilities.Insert(new AbilityRecord(WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_STARTLOOPABLE_SHOTGUN_COCKED));
91 m_abilities.Insert(new AbilityRecord(WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_STARTLOOPABLE_SHOTGUN_UNCOCKED));
92 m_abilities.Insert(new AbilityRecord(WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_ENDLOOPABLE));
93
94 // basic weapon states
95 E = new PumpShotgunEmpty(this, NULL, PumpShotgunAnimState.DEFAULT);
96 F = new PumpShotgunFireout(this, NULL, PumpShotgunAnimState.DEFAULT);
97 L = new PumpShotgunLoaded(this, NULL, PumpShotgunAnimState.DEFAULT);
98 J = new PumpShotgunJammed(this, NULL, PumpShotgunAnimState.DEFAULT);
99 //--------------------------------------------------------------------------------------
100 WeaponStateBase Mech_E = new WeaponChargingInnerMag(this, NULL, WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED);
101 WeaponStateBase Mech_F = new WeaponChargingInnerMag(this, NULL, WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED);
102 WeaponStateBase Mech_L = new WeaponChargingInnerMag(this, NULL, WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED);
103
104 LoopedChamberingEjectLast Chamber_E = new LoopedChamberingEjectLast(this, NULL, WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_STARTLOOPABLE_SHOTGUN_UNCOCKED, WeaponActionChamberingTypes.CHAMBERING_ENDLOOPABLE);
105 LoopedChamberingEjectLast Chamber_F = new LoopedChamberingEjectLast(this, NULL, WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_STARTLOOPABLE_SHOTGUN_UNCOCKED, WeaponActionChamberingTypes.CHAMBERING_ENDLOOPABLE);
106 LoopedChamberingEjectLast Chamber_L = new LoopedChamberingEjectLast(this, NULL, WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_STARTLOOPABLE_SHOTGUN_COCKED, WeaponActionChamberingTypes.CHAMBERING_ENDLOOPABLE);
107
109
114
116
117 WeaponEventBase _fin_ = new WeaponEventHumanCommandActionFinished;
118 WeaponEventBase __L__ = new WeaponEventLoad1Bullet;
119 WeaponEventBase __T__ = new WeaponEventTrigger;
120 WeaponEventBase __TJ_ = new WeaponEventTriggerToJam;
121 WeaponEventBase __U__ = new WeaponEventUnjam;
122 WeaponEventBase __M__ = new WeaponEventMechanism;
123 WeaponEventBase _abt_ = new WeaponEventHumanCommandActionAborted;
124 WeaponEventBase _rto_ = new WeaponEventReloadTimeout;
125 WeaponEventBase _dto_ = new WeaponEventDryFireTimeout;
126
127 m_fsm = new WeaponFSM();
128
129 // Mechanism
130 m_fsm.AddTransition(new WeaponTransition(E, __M__, Mech_L));
131 //----------------------------------------
132
133 m_fsm.AddTransition(new WeaponTransition(L, __M__, Mech_L));
134 m_fsm.AddTransition(new WeaponTransition(Mech_L, _fin_, E, NULL, new WeaponGuardCurrentChamberEmpty(this)));
135 m_fsm.AddTransition(new WeaponTransition(Mech_L, _fin_, L));
136 m_fsm.AddTransition(new WeaponTransition(Mech_L, _abt_, E, NULL, new WeaponGuardCurrentChamberEmpty(this)));
137 m_fsm.AddTransition(new WeaponTransition(Mech_L, _abt_, L));
138
139 m_fsm.AddTransition(new WeaponTransition(F, __M__, Mech_F));
140 m_fsm.AddTransition(new WeaponTransition(Mech_F, _fin_, E, NULL, new WeaponGuardCurrentChamberEmpty(this)));
141 m_fsm.AddTransition(new WeaponTransition(Mech_F, _fin_, F, NULL, new WeaponGuardCurrentChamberFiredOut(this)));
142 m_fsm.AddTransition(new WeaponTransition(Mech_F, _fin_, L));
143 m_fsm.AddTransition(new WeaponTransition(Mech_F, _abt_, E, NULL, new WeaponGuardCurrentChamberEmpty(this)));
144 m_fsm.AddTransition(new WeaponTransition(Mech_F, _abt_, F, NULL, new WeaponGuardCurrentChamberFiredOut(this)));
145 m_fsm.AddTransition(new WeaponTransition(Mech_F, _abt_, L));
146
147 //----------------------------------------
148
149 m_fsm.AddTransition(new WeaponTransition(E, __L__, Chamber_E));
150 m_fsm.AddTransition(new WeaponTransition(Chamber_E, _fin_, E, NULL, new WeaponGuardCurrentChamberEmpty(this)));
151 m_fsm.AddTransition(new WeaponTransition(Chamber_E, _fin_, L));
152 m_fsm.AddTransition(new WeaponTransition(Chamber_E, _abt_, E, NULL, new WeaponGuardCurrentChamberEmpty(this)));
153 m_fsm.AddTransition(new WeaponTransition(Chamber_E, _abt_, L));
154
155 m_fsm.AddTransition(new WeaponTransition(L, __L__, Chamber_L, NULL, new GuardNot(new WeaponGuardInnerMagazineFull(this))));
156 m_fsm.AddTransition(new WeaponTransition(Chamber_L, _fin_, L));
157 m_fsm.AddTransition(new WeaponTransition(Chamber_L, _abt_, L));
158
159 m_fsm.AddTransition(new WeaponTransition(F, __L__, Chamber_F, NULL, new GuardNot(new WeaponGuardInnerMagazineFull(this))));
160 m_fsm.AddTransition(new WeaponTransition(Chamber_F, _fin_, F, NULL, new WeaponGuardCurrentChamberFiredOut(this)));
161 m_fsm.AddTransition(new WeaponTransition(Chamber_F, _fin_, L));
162 m_fsm.AddTransition(new WeaponTransition(Chamber_F, _abt_, F, NULL, new WeaponGuardCurrentChamberFiredOut(this)));
163 m_fsm.AddTransition(new WeaponTransition(Chamber_F, _abt_, L));
164
165
166 //-------------------------------------------
167
168 m_fsm.AddTransition(new WeaponTransition(J, __U__, Unjam_J));
169 m_fsm.AddTransition(new WeaponTransition(Unjam_J, _fin_, J, NULL, new WeaponGuardJammed(this)));
170 m_fsm.AddTransition(new WeaponTransition(Unjam_J, _fin_, E, NULL, new WeaponGuardCurrentChamberEmpty(this)));
171 m_fsm.AddTransition(new WeaponTransition(Unjam_J, _fin_, L));
172 m_fsm.AddTransition(new WeaponTransition(Unjam_J, _abt_, J, NULL, new WeaponGuardJammed(this)));
173 m_fsm.AddTransition(new WeaponTransition(Unjam_J, _abt_, E, NULL, new WeaponGuardCurrentChamberEmpty(this)));
174 m_fsm.AddTransition(new WeaponTransition(Unjam_J, _abt_, L));
175
176 //-----------------------------------------
177
178 // fire
179 m_fsm.AddTransition(new WeaponTransition(E, __T__, Trigger_E)); // fire.cocked
180 m_fsm.AddTransition(new WeaponTransition(Trigger_E, _fin_, E));
181 m_fsm.AddTransition(new WeaponTransition(Trigger_E, _dto_, E));
182 m_fsm.AddTransition(new WeaponTransition(Trigger_E, _abt_, E));
183
184 m_fsm.AddTransition(new WeaponTransition(L, __T__, Trigger_L)); // fire.cocked
185 m_fsm.AddTransition(new WeaponTransition(Trigger_L, _fin_, F));
186 m_fsm.AddTransition(new WeaponTransition(Trigger_L, _rto_, F));
187 m_fsm.AddTransition(new WeaponTransition(Trigger_L, _abt_, F));
188
189 m_fsm.AddTransition(new WeaponTransition(L, __TJ_, Trigger_LJ)); // fire.cocked
190 m_fsm.AddTransition(new WeaponTransition(Trigger_LJ, _fin_, J));
191 m_fsm.AddTransition(new WeaponTransition(Trigger_LJ, _rto_, J));
192 m_fsm.AddTransition(new WeaponTransition(Trigger_LJ, _abt_, J));
193
194 m_fsm.AddTransition(new WeaponTransition(F, __T__, Trigger_F)); // fire.cocked
195 m_fsm.AddTransition(new WeaponTransition(Trigger_F, _fin_, F));
196 m_fsm.AddTransition(new WeaponTransition(Trigger_F, _dto_, F));
197 m_fsm.AddTransition(new WeaponTransition(Trigger_F, _abt_, F));
198
199 m_fsm.AddTransition(new WeaponTransition(J, __T__, Trigger_J)); // fire.cocked
200 m_fsm.AddTransition(new WeaponTransition(Trigger_J, _fin_, J));
201 m_fsm.AddTransition(new WeaponTransition(Trigger_J, _dto_, J));
202 m_fsm.AddTransition(new WeaponTransition(Trigger_J, _abt_, J));
203
204 //-----------------------------------------
205
206 SetInitialState(E);
207
208 SelectionBulletHide();
209 HideMagazine();
210
211 m_fsm.Start();
212 }
PumpShotgunAnimState
Definition MP133.c:2
enum FSMTransition WeaponTransition
pair ( action, actionType )
Definition Weapon_Base.c:5
ref WeaponStableState F
Definition MP133.c:67
ref WeaponStableState J
Definition MP133.c:69
ref WeaponStableState L
Definition MP133.c:68
ref WeaponStableState E
Definition MP133.c:66
signalize mechanism manipulation
Definition Events.c:35
weapon finite state machine
represent weapon state base
Definition BulletHide.c:2
unjam submachine
WeaponActionChamberingTypes
Definition human.c:856
WeaponActions
actions
Definition human.c:796
WeaponActionUnjammingTypes
Definition human.c:892
WeaponActionFireTypes
Definition human.c:900

References E, F, J, and L.

◆ Mp133Shotgun()

void Mp133Shotgun_Base::Mp133Shotgun ( )
inlineprivate

Definition at line 71 of file MP133.c.

72 {
73 }

◆ OnDebugSpawn()

override void Mp133Shotgun_Base::OnDebugSpawn ( )
inlineprivate

Definition at line 229 of file MP133.c.

230 {
231 super.OnDebugSpawn();
232 GameInventory inventory = GetInventory();
233 inventory.CreateInInventory("FNP45_MRDSOptic");
234 inventory.CreateInInventory("Battery9V");
235
237 if (Class.CastTo(entity, this))
238 {
239 entity.SpawnEntityOnGroundPos("Ammo_12gaPellets", entity.GetPosition());
240 entity.SpawnEntityOnGroundPos("Ammo_12gaSlug", entity.GetPosition());
241 entity.SpawnEntityOnGroundPos("Ammo_12gaRubberSlug", entity.GetPosition());
242 }
243 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
script counterpart to engine's class Inventory
Definition Inventory.c:79
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo().

◆ SetActions()

override void Mp133Shotgun_Base::SetActions ( )
inlineprivate

Definition at line 219 of file MP133.c.

220 {
221 super.SetActions();
223
226 }
void AddAction(typename actionName)
void RemoveAction(typename actionName)
FirearmActionLoadBullet FirearmActionBase FirearmActionLoadBulletQuick()

References AddAction(), FirearmActionLoadBulletQuick(), and RemoveAction().

◆ SpawnRecoilObject()

override RecoilBase Mp133Shotgun_Base::SpawnRecoilObject ( )
inlineprivate

Definition at line 75 of file MP133.c.

76 {
77 return new Mp133Recoil(this);
78 }

Member Data Documentation

◆ E

ref WeaponStableState Mp133Shotgun_Base::E
private

Definition at line 66 of file MP133.c.

Referenced by InitStateMachine().

◆ F

ref WeaponStableState Mp133Shotgun_Base::F
private

Definition at line 67 of file MP133.c.

Referenced by InitStateMachine().

◆ J

ref WeaponStableState Mp133Shotgun_Base::J
private

Definition at line 69 of file MP133.c.

Referenced by InitStateMachine().

◆ L

ref WeaponStableState Mp133Shotgun_Base::L
private

Definition at line 68 of file MP133.c.

Referenced by InitStateMachine().


The documentation for this class was generated from the following file: