34 override bool HasBullet () {
return true; }
36 override bool IsJammed () {
return false; }
45 override bool HasBullet () {
return true; }
47 override bool IsJammed () {
return false; }
56 override bool HasBullet () {
return false; }
58 override bool IsJammed () {
return false; }
67 override bool HasBullet () {
return true; }
69 override bool IsJammed () {
return true; }
79 override bool HasBullet () {
return true; }
81 override bool IsJammed () {
return true; }
101 void RifleBoltFree_Base ()
106 override void InitStateMachine()
109 m_abilities.Insert(
new AbilityRecord(WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADRIFLE_MAGAZINE_BULLET)));
110 m_abilities.Insert(
new AbilityRecord(WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADRIFLE_NOMAGAZINE_BULLET)));
111 m_abilities.Insert(
new AbilityRecord(WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADRIFLE_MAGAZINE_NOBULLET)));
112 m_abilities.Insert(
new AbilityRecord(WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADRIFLE_NOMAGAZINE_NOBULLET)));
113 m_abilities.Insert(
new AbilityRecord(WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADRIFLE_MAGAZINE_DETACH)));
115 m_abilities.Insert(
new AbilityRecord(WeaponActions.CHAMBERING, GetWeaponSpecificCommand(WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_ONEBULLET_CLOSED)));
117 m_abilities.Insert(
new AbilityRecord(WeaponActions.MECHANISM, GetWeaponSpecificCommand(WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED)));
119 m_abilities.Insert(
new AbilityRecord(WeaponActions.UNJAMMING, GetWeaponSpecificCommand(WeaponActions.UNJAMMING, WeaponActionUnjammingTypes.UNJAMMING_START)));
120 m_abilities.Insert(
new AbilityRecord(WeaponActions.UNJAMMING, GetWeaponSpecificCommand(WeaponActions.UNJAMMING, WeaponActionUnjammingTypes.UNJAMMING_END)));
122 m_abilities.Insert(
new AbilityRecord(WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_JAM)));
123 m_abilities.Insert(
new AbilityRecord(WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_NORMAL)));
124 m_abilities.Insert(
new AbilityRecord(WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_DRY)));
138 WeaponCharging Mech_C00 =
new WeaponCharging(
this, NULL, WeaponActions.MECHANISM, GetWeaponSpecificCommand(WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED));
139 WeaponCharging Mech_C01 =
new WeaponCharging(
this, NULL, WeaponActions.MECHANISM, GetWeaponSpecificCommand(WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED));
141 WeaponCharging Mech_C10 =
new WeaponCharging(
this, NULL, WeaponActions.MECHANISM, GetWeaponSpecificCommand(WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED));
142 WeaponCharging Mech_C11 =
new WeaponCharging(
this, NULL, WeaponActions.MECHANISM, GetWeaponSpecificCommand(WeaponActions.MECHANISM, WeaponActionMechanismTypes.MECHANISM_CLOSED));
144 WeaponStateBase Trigger_C00 =
new WeaponDryFire(
this, NULL, WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_DRY));
145 WeaponStateBase Trigger_C10 =
new WeaponFireLast(
this, NULL, WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_NORMAL));
146 WeaponFireAndChamberNext Trigger_C11 =
new WeaponFireAndChamberNext(
this, NULL, WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_NORMAL));
147 WeaponStateBase Trigger_C11L =
new WeaponFireLast(
this, NULL, WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_NORMAL));
148 WeaponStateBase Trigger_C01 =
new WeaponDryFire(
this, NULL, WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_DRY));
149 WeaponStateBase Trigger_JF0 =
new WeaponDryFire(
this, NULL, WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_DRY));
150 WeaponStateBase Trigger_JF1 =
new WeaponDryFire(
this, NULL, WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_DRY));
154 WeaponStateBase Trigger_C10J =
new WeaponFireToJam(
this, NULL, WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_JAM));
155 WeaponStateBase Trigger_C11J =
new WeaponFireToJam(
this, NULL, WeaponActions.FIRE, GetWeaponSpecificCommand(WeaponActions.FIRE, WeaponActionFireTypes.FIRE_JAM));
157 WeaponStateBase Unjam_JF0 =
new WeaponUnjamming(
this, NULL, WeaponActions.UNJAMMING, GetWeaponSpecificCommand(WeaponActions.UNJAMMING, WeaponActionUnjammingTypes.UNJAMMING_START));
158 WeaponStateBase Unjam_JF1 =
new WeaponUnjamming(
this, NULL, WeaponActions.UNJAMMING, GetWeaponSpecificCommand(WeaponActions.UNJAMMING, WeaponActionUnjammingTypes.UNJAMMING_START));
161 WeaponChambering Chamber_C00 =
new WeaponChambering(
this, NULL, WeaponActions.CHAMBERING, GetWeaponSpecificCommand(WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_ONEBULLET_CLOSED));
162 WeaponChambering Chamber_C01 =
new WeaponChambering(
this, NULL, WeaponActions.CHAMBERING, GetWeaponSpecificCommand(WeaponActions.CHAMBERING, WeaponActionChamberingTypes.CHAMBERING_ONEBULLET_CLOSED));
164 WeaponAttachMagazine Attach_C00 =
new WeaponAttachMagazine(
this, NULL, WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADRIFLE_NOMAGAZINE_NOBULLET));
165 WeaponAttachMagazine Attach_C10 =
new WeaponAttachMagazine(
this, NULL, WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADRIFLE_NOMAGAZINE_BULLET));
166 WeaponAttachMagazine Attach_JF0 =
new WeaponAttachMagazine(
this, NULL, WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADRIFLE_NOMAGAZINE_BULLET));
172 WeaponDetachingMag Detach_C11 =
new WeaponDetachingMag(
this, NULL, WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADRIFLE_MAGAZINE_DETACH));
173 WeaponDetachingMag Detach_C01 =
new WeaponDetachingMag(
this, NULL, WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADRIFLE_MAGAZINE_DETACH));
174 WeaponDetachingMag Detach_JF1 =
new WeaponDetachingMag(
this, NULL, WeaponActions.RELOAD, GetWeaponSpecificCommand(WeaponActions.RELOAD, WeaponActionReloadTypes.RELOADRIFLE_MAGAZINE_DETACH));
199 m_fsm.AddTransition(
new WeaponTransition( Mech_C10, _fin_, C00, NULL,
new WeaponGuardCurrentChamberEmpty(
this)));
201 m_fsm.AddTransition(
new WeaponTransition( Mech_C10, _abt_, C00, NULL,
new WeaponGuardCurrentChamberEmpty(
this)));
205 m_fsm.AddTransition(
new WeaponTransition( Mech_C11, _fin_, C01, NULL,
new WeaponGuardCurrentChamberEmpty(
this) ));
207 m_fsm.AddTransition(
new WeaponTransition( Mech_C11, _abt_, C01, NULL,
new WeaponGuardCurrentChamberEmpty(
this) ));
211 m_fsm.AddTransition(
new WeaponTransition( Mech_C01, _fin_, C01, NULL,
new WeaponGuardCurrentChamberEmpty(
this)));
213 m_fsm.AddTransition(
new WeaponTransition( Mech_C01, _abt_, C01, NULL,
new WeaponGuardCurrentChamberEmpty(
this)));
267 m_fsm.AddTransition(
new WeaponTransition( Chamber_C00, _fin_, C00, NULL,
new WeaponGuardCurrentChamberEmpty(
this) ));
269 m_fsm.AddTransition(
new WeaponTransition( Chamber_C00, _abt_, C00, NULL,
new WeaponGuardCurrentChamberEmpty(
this) ));
273 m_fsm.AddTransition(
new WeaponTransition( Chamber_C01, _fin_, C01, NULL,
new WeaponGuardCurrentChamberEmpty(
this) ));
275 m_fsm.AddTransition(
new WeaponTransition( Chamber_C01, _abt_, C01, NULL,
new WeaponGuardCurrentChamberEmpty(
this) ));
279 m_fsm.AddTransition(
new WeaponTransition( C00, __A__, Attach_C00, NULL,
new WeaponGuardCanAttachMag(
this)));
280 m_fsm.AddTransition(
new WeaponTransition( Attach_C00, _fin_, C11, NULL,
new WeaponGuardCurrentChamberFull(
this)));
281 m_fsm.AddTransition(
new WeaponTransition( Attach_C00, _fin_, C01, NULL,
new WeaponGuardHasMag(
this)));
283 m_fsm.AddTransition(
new WeaponTransition( Attach_C00, _abt_, C11, NULL,
new WeaponGuardCurrentChamberFull(
this)));
284 m_fsm.AddTransition(
new WeaponTransition( Attach_C00, _abt_, C01, NULL,
new WeaponGuardHasMag(
this)));
287 m_fsm.AddTransition(
new WeaponTransition( C10, __A__, Attach_C10, NULL,
new WeaponGuardCanAttachMag(
this)));
288 m_fsm.AddTransition(
new WeaponTransition( Attach_C10, _fin_, C11, NULL,
new WeaponGuardHasMag(
this)));
290 m_fsm.AddTransition(
new WeaponTransition( Attach_C10, _abt_, C11, NULL,
new WeaponGuardHasMag(
this)));
293 m_fsm.AddTransition(
new WeaponTransition( JF0, __A__, Attach_JF0, NULL,
new WeaponGuardCanAttachMag(
this)));
294 m_fsm.AddTransition(
new WeaponTransition( Attach_JF0, _fin_, JF1, NULL,
new WeaponGuardHasMag(
this)));
296 m_fsm.AddTransition(
new WeaponTransition( Attach_JF0, _abt_, JF1, NULL,
new WeaponGuardHasMag(
this)));
300 m_fsm.AddTransition(
new WeaponTransition( C11, __S__, Reload_C11, NULL,
new WeaponGuardCanSwapMag(
this)));
301 m_fsm.AddTransition(
new WeaponTransition( Reload_C11, _fin_, C11, NULL,
new WeaponGuardHasMag(
this)));
303 m_fsm.AddTransition(
new WeaponTransition( Reload_C11, _abt_, C11, NULL,
new WeaponGuardHasMag(
this)));
306 m_fsm.AddTransition(
new WeaponTransition( C01, __S__, Reload_C01, NULL,
new WeaponGuardCanSwapMag(
this)));
307 m_fsm.AddTransition(
new WeaponTransition( Reload_C01, _fin_, C11, NULL,
new WeaponGuardCurrentChamberFull(
this)));
308 m_fsm.AddTransition(
new WeaponTransition( Reload_C01, _fin_, C01, NULL,
new WeaponGuardHasMag(
this)));
310 m_fsm.AddTransition(
new WeaponTransition( Reload_C01, _abt_, C11, NULL,
new WeaponGuardCurrentChamberFull(
this)));
311 m_fsm.AddTransition(
new WeaponTransition( Reload_C01, _abt_, C01, NULL,
new WeaponGuardHasMag(
this)));
314 m_fsm.AddTransition(
new WeaponTransition( JF1, __S__, Reload_JF1, NULL,
new WeaponGuardCanSwapMag(
this)));
315 m_fsm.AddTransition(
new WeaponTransition( Reload_JF1, _fin_, JF1, NULL,
new WeaponGuardHasMag(
this)));
317 m_fsm.AddTransition(
new WeaponTransition( Reload_JF1, _abt_, JF1, NULL,
new WeaponGuardHasMag(
this)));
322 m_fsm.AddTransition(
new WeaponTransition( C11, __D__, Detach_C11, NULL,
new WeaponGuardCanDetachMag(
this)));
323 m_fsm.AddTransition(
new WeaponTransition( Detach_C11, _fin_, C11, NULL,
new WeaponGuardHasMag(
this)));
325 m_fsm.AddTransition(
new WeaponTransition( Detach_C11, _abt_, C11, NULL,
new WeaponGuardHasMag(
this)));
329 m_fsm.AddTransition(
new WeaponTransition( C01, __D__, Detach_C01, NULL,
new WeaponGuardCanDetachMag(
this)));
330 m_fsm.AddTransition(
new WeaponTransition( Detach_C01, _fin_, C01, NULL,
new WeaponGuardHasMag(
this)));
332 m_fsm.AddTransition(
new WeaponTransition( Detach_C01, _abt_, C01, NULL,
new WeaponGuardHasMag(
this)));
335 m_fsm.AddTransition(
new WeaponTransition( JF1, __D__, Detach_JF1, NULL,
new WeaponGuardCanDetachMag(
this)));
336 m_fsm.AddTransition(
new WeaponTransition( Detach_JF1, _fin_, JF1, NULL,
new WeaponGuardHasMag(
this)));
338 m_fsm.AddTransition(
new WeaponTransition( Detach_JF1, _abt_, JF1, NULL,
new WeaponGuardHasMag(
this)));
343 m_fsm.AddTransition(
new WeaponTransition( Unjam_JF0, _fin_, JF0, NULL,
new WeaponGuardJammed(
this)));
345 m_fsm.AddTransition(
new WeaponTransition( Unjam_JF0, _abt_, JF0, NULL,
new WeaponGuardJammed(
this)));
349 m_fsm.AddTransition(
new WeaponTransition( Unjam_JF1, _fin_, JF1, NULL,
new WeaponGuardJammed(
this)));
350 m_fsm.AddTransition(
new WeaponTransition( Unjam_JF1, _fin_, C01, NULL,
new WeaponGuardCurrentChamberEmpty(
this)));
352 m_fsm.AddTransition(
new WeaponTransition( Unjam_JF1, _abt_, JF1, NULL,
new WeaponGuardJammed(
this)));
353 m_fsm.AddTransition(
new WeaponTransition( Unjam_JF1, _abt_, C01, NULL,
new WeaponGuardCurrentChamberEmpty(
this)));
356 SetInitialState(C00);
358 SelectionBulletHide();
364 override float GetChanceToJam()
366 float chanceToJam = super.GetChanceToJam();
367 Magazine mag = GetMagazine(GetCurrentMuzzle());
371 chanceToJam = chanceToJam + ((1.0 - chanceToJam) * mag.GetChanceToJam());
375 chanceToJam = chanceToJam + ((1.0 - chanceToJam) * 0.06);
void AddAction(typename actionName)
pair ( action, actionType )
base for rifles @NOTE name copies config base class
charging of weapon without ammo to be chambered
signalize mechanism manipulation
weapon finite state machine
replace current magazine with new one
represents weapon's stable state (i.e. the basic states that the weapon will spend the most time in)
represent weapon state base
override bool IsRepairEnabled()
override bool HasBullet()
override void InitMuzzleArray()
override bool HasMagazine()
proto void Print(void var)
Prints content of variable to console/log.
class WeaponGuardIsDestroyed extends WeaponGuardBase m_weapon
void WeaponGuardHasAmmo(Weapon_Base w=NULL)
override int GetCurrentStateID()
override bool IsBoltOpen()
@ DEFAULT
default weapon state, closed and discharged
class SSPFireout extends WeaponStableState OnEntry
enum FSMTransition WeaponTransition
class WeaponChambering_Chamber_OnEntry extends WeaponChambering_Base OnExit
ref array< MuzzleState > m_muzzleHasBullet