162 return super.CanChamberBullet(muzzleIndex,mag) && IsChamberEmpty(muzzleIndex);
201 CD00 =
new Pistol_CLO_DIS_BU0_MA0(
this, NULL,
PistolAnimState.DEFAULT);
202 CC00 =
new Pistol_CLO_CHG_BU0_MA0(
this, NULL,
PistolAnimState.CLOSED_CHARGED);
203 CC10 =
new Pistol_CLO_CHG_BU1_MA0(
this, NULL,
PistolAnimState.CLOSED_CHARGED);
205 OD00 =
new Pistol_OPE_DIS_BU0_MA0(
this, NULL,
PistolAnimState.OPENED_DISCHARGED);
206 CD01 =
new Pistol_CLO_DIS_BU0_MA1(
this, NULL,
PistolAnimState.DEFAULT);
207 CC01 =
new Pistol_CLO_CHG_BU0_MA1(
this, NULL,
PistolAnimState.CLOSED_CHARGED);
208 CC11 =
new Pistol_CLO_CHG_BU1_MA1(
this, NULL,
PistolAnimState.CLOSED_CHARGED);
210 OD01 =
new Pistol_OPE_DIS_BU0_MA1(
this, NULL,
PistolAnimState.OPENED_DISCHARGED);
287 Mech_CD00.AddTransition(
new WeaponTransition( Mech_CD00.m_start, _abt_, CD00));
288 Mech_CD00.AddTransition(
new WeaponTransition( Mech_CD00.m_eject, _abt_, CC00));
289 Mech_CD00.AddTransition(
new WeaponTransition( Mech_CD00.m_onCK, _abt_, CC00));
290 Mech_CD00.AddTransition(
new WeaponTransition( Mech_CD00.m_chamber, _abt_, CC00));
298 Mech_OD00.AddTransition(
new WeaponTransition( Mech_OD00.m_start, _abt_, OD00));
299 Mech_OD00.AddTransition(
new WeaponTransition( Mech_OD00.m_eject, _abt_, CC00));
300 Mech_OD00.AddTransition(
new WeaponTransition( Mech_OD00.m_onCK, _abt_, CC00));
301 Mech_OD00.AddTransition(
new WeaponTransition( Mech_OD00.m_chamber, _abt_, CC00));
304 m_fsm.AddTransition(
new WeaponTransition( Mech_OD01, _fin_, CC01, NULL,
new WeaponGuardCurrentChamberEmpty(
this) ));
306 Mech_OD01.AddTransition(
new WeaponTransition( Mech_OD01.m_start, _abt_, OD01));
307 Mech_OD01.AddTransition(
new WeaponTransition( Mech_OD01.m_eject, _abt_, CC01));
308 Mech_OD01.AddTransition(
new WeaponTransition( Mech_OD01.m_onCK, _abt_, CC01));
309 Mech_OD01.AddTransition(
new WeaponTransition( Mech_OD01.m_chamber, _abt_, CC11));
312 m_fsm.AddTransition(
new WeaponTransition( Mech_CD01, _fin_, CC01, NULL,
new WeaponGuardCurrentChamberEmpty(
this)));
314 Mech_CD01.AddTransition(
new WeaponTransition( Mech_CD01.m_start, _abt_, CD01));
315 Mech_CD01.AddTransition(
new WeaponTransition( Mech_CD01.m_eject, _abt_, CC01));
316 Mech_CD01.AddTransition(
new WeaponTransition( Mech_CD01.m_onCK, _abt_, CC01));
317 Mech_CD01.AddTransition(
new WeaponTransition( Mech_CD01.m_chamber, _abt_, CC11));
320 m_fsm.AddTransition(
new WeaponTransition( Mech_CC01, _fin_, CC01, NULL,
new WeaponGuardCurrentChamberEmpty(
this)));
322 m_fsm.AddTransition(
new WeaponTransition( Mech_CC01, _abt_, CC01, NULL,
new WeaponGuardCurrentChamberEmpty(
this)));
328 m_fsm.AddTransition(
new WeaponTransition( Mech_CC10, _abt_, CC00, NULL,
new WeaponGuardCurrentChamberEmpty(
this)));
332 m_fsm.AddTransition(
new WeaponTransition( Mech_CC11, _fin_, CC01, NULL,
new WeaponGuardCurrentChamberEmpty(
this)));
334 m_fsm.AddTransition(
new WeaponTransition( Mech_CC11, _abt_, CC01, NULL,
new WeaponGuardCurrentChamberEmpty(
this)));
408 Chamber_CD00.AddTransition(
new WeaponTransition( Chamber_CD00.m_start, _abt_, CD00));
409 Chamber_CD00.AddTransition(
new WeaponTransition( Chamber_CD00.m_eject, _abt_, OD00));
410 Chamber_CD00.AddTransition(
new WeaponTransition( Chamber_CD00.m_chamber, _abt_, OD00));
411 Chamber_CD00.AddTransition(
new WeaponTransition( Chamber_CD00.m_w4t, _abt_, CC10));
415 m_fsm.AddTransition(
new WeaponTransition( Chamber_OD00, _abt_, OD00, NULL,
new WeaponGuardCurrentChamberEmpty(
this) ));
420 Chamber_CC00.AddTransition(
new WeaponTransition( Chamber_CC00.m_start, _abt_, CC00));
421 Chamber_CC00.AddTransition(
new WeaponTransition( Chamber_CC00.m_eject, _abt_, OD00));
422 Chamber_CC00.AddTransition(
new WeaponTransition( Chamber_CC00.m_chamber, _abt_, OD00));
423 Chamber_CC00.AddTransition(
new WeaponTransition( Chamber_CC00.m_w4t, _abt_, CC10));
426 m_fsm.AddTransition(
new WeaponTransition( CD01, __L__, Chamber_CD01, NULL,
new WeaponGuardHasMag(
this)));
428 Chamber_CD01.AddTransition(
new WeaponTransition( Chamber_CD01.m_start, _abt_, CD01));
429 Chamber_CD01.AddTransition(
new WeaponTransition( Chamber_CD01.m_eject, _abt_, OD01));
430 Chamber_CD01.AddTransition(
new WeaponTransition( Chamber_CD01.m_chamber, _abt_, OD01));
431 Chamber_CD01.AddTransition(
new WeaponTransition( Chamber_CD01.m_w4t, _abt_, CC11));
433 m_fsm.AddTransition(
new WeaponTransition( CC01, __L__, Chamber_CC01, NULL,
new WeaponGuardHasMag(
this)));
435 Chamber_CC01.AddTransition(
new WeaponTransition( Chamber_CC01.m_start, _abt_, CC01));
436 Chamber_CC01.AddTransition(
new WeaponTransition( Chamber_CC01.m_eject, _abt_, OD01));
437 Chamber_CC01.AddTransition(
new WeaponTransition( Chamber_CC01.m_chamber, _abt_, OD01));
438 Chamber_CC01.AddTransition(
new WeaponTransition( Chamber_CC01.m_w4t, _abt_, CC11));
440 m_fsm.AddTransition(
new WeaponTransition( OD01, __L__, Chamber_OD01, NULL,
new WeaponGuardHasMag(
this)));
442 m_fsm.AddTransition(
new WeaponTransition( Chamber_OD01, _abt_, OD01, NULL,
new WeaponGuardCurrentChamberEmpty(
this) ));
445 m_fsm.AddTransition(
new WeaponTransition( CJF0, __A__, Attach_CJF0, NULL,
new WeaponGuardCanAttachMag(
this)));
449 Attach_CJF0.AddTransition(
new WeaponTransition( Attach_CJF0.m_start, _abt_, CJF0));
450 Attach_CJF0.AddTransition(
new WeaponTransition( Attach_CJF0.m_attach, _abt_, CJF0));
454 m_fsm.AddTransition(
new WeaponTransition( CD00, __A__, Attach_CD00, NULL,
new WeaponGuardCanAttachMag(
this)));
455 m_fsm.AddTransition(
new WeaponTransition( Attach_CD00, _fin_, CC01, NULL,
new WeaponGuardCurrentChamberEmpty(
this)));
457 Attach_CD00.AddTransition(
new WeaponTransition( Attach_CD00.m_start, _abt_, CD00));
458 Attach_CD00.AddTransition(
new WeaponTransition( Attach_CD00.m_attach, _abt_, CD00));
459 Attach_CD00.AddTransition(
new WeaponTransition( Attach_CD00.m_onCK, _abt_, CC01));
460 Attach_CD00.AddTransition(
new WeaponTransition( Attach_CD00.m_chamber, _abt_, CC11));
462 m_fsm.AddTransition(
new WeaponTransition( CC10, __A__, Attach_CC10, NULL,
new WeaponGuardCanAttachMag(
this)));
464 Attach_CC10.AddTransition(
new WeaponTransition( Attach_CC10.m_start, _abt_, CC10));
465 Attach_CC10.AddTransition(
new WeaponTransition( Attach_CC10.m_attach, _abt_, CC10));
467 m_fsm.AddTransition(
new WeaponTransition( OD00, __A__, Attach_OD00, NULL,
new WeaponGuardCanAttachMag(
this)));
468 m_fsm.AddTransition(
new WeaponTransition( Attach_OD00, _fin_, CC01, NULL,
new WeaponGuardCurrentChamberEmpty(
this)));
470 Attach_OD00.AddTransition(
new WeaponTransition( Attach_OD00.m_start, _abt_, OD00));
471 Attach_OD00.AddTransition(
new WeaponTransition( Attach_OD00.m_attach, _abt_, OD00));
472 Attach_OD00.AddTransition(
new WeaponTransition( Attach_OD00.m_onCK, _abt_, CC01));
473 Attach_OD00.AddTransition(
new WeaponTransition( Attach_OD00.m_chamber, _abt_, CC11));
475 m_fsm.AddTransition(
new WeaponTransition( CC00, __A__, Attach_CC00, NULL,
new WeaponGuardCanAttachMag(
this)));
476 m_fsm.AddTransition(
new WeaponTransition( Attach_CC00, _fin_, CC01, NULL,
new WeaponGuardCurrentChamberEmpty(
this)));
478 Attach_CC00.AddTransition(
new WeaponTransition( Attach_CC00.m_start, _abt_, CC00));
479 Attach_CC00.AddTransition(
new WeaponTransition( Attach_CC00.m_attach, _abt_, CC00));
480 Attach_CC00.AddTransition(
new WeaponTransition( Attach_CC00.m_onCK, _abt_, CC01));
481 Attach_CC00.AddTransition(
new WeaponTransition( Attach_CC00.m_chamber, _abt_, CC11));
484 m_fsm.AddTransition(
new WeaponTransition( CD01, __S__, Reload_CD01, NULL,
new WeaponGuardCanSwapMag(
this)));
485 m_fsm.AddTransition(
new WeaponTransition( Reload_CD01, _fin_, CC01, NULL,
new WeaponGuardCurrentChamberEmpty(
this)));
487 Reload_CD01.AddTransition(
new WeaponTransition( Reload_CD01.m_start, _abt_, CD01));
488 Reload_CD01.AddTransition(
new WeaponTransition( Reload_CD01.m_eject, _abt_, CD01));
489 Reload_CD01.AddTransition(
new WeaponTransition( Reload_CD01.m_detach, _abt_, CD01));
490 Reload_CD01.AddTransition(
new WeaponTransition( Reload_CD01.m_hideOld, _abt_, CD00));
491 Reload_CD01.AddTransition(
new WeaponTransition( Reload_CD01.m_swapMags, _abt_, CD01));
492 Reload_CD01.AddTransition(
new WeaponTransition( Reload_CD01.m_attach, _abt_, CD01));
493 Reload_CD01.AddTransition(
new WeaponTransition( Reload_CD01.m_onCK, _abt_, CC01));
494 Reload_CD01.AddTransition(
new WeaponTransition( Reload_CD01.m_chamber, _abt_, CC11));
497 m_fsm.AddTransition(
new WeaponTransition( CC11, __S__, Reload_CC11, NULL,
new WeaponGuardCanSwapMag(
this)));
499 m_fsm.AddTransition(
new WeaponTransition( Reload_CC11, _abt_, CC11, NULL,
new WeaponGuardHasMag(
this)));
502 m_fsm.AddTransition(
new WeaponTransition( CC01, __S__, Reload_CC01, NULL,
new WeaponGuardCanSwapMag(
this)));
503 m_fsm.AddTransition(
new WeaponTransition( Reload_CC01, _fin_, CC01, NULL,
new WeaponGuardCurrentChamberEmpty(
this)));
505 m_fsm.AddTransition(
new WeaponTransition( Reload_CC01, _abt_, CC11, NULL,
new WeaponGuardCurrentChamberFull(
this)) );
506 m_fsm.AddTransition(
new WeaponTransition( Reload_CC01, _abt_, CC01, NULL,
new WeaponGuardHasMag(
this)) );
509 m_fsm.AddTransition(
new WeaponTransition( OD01, __S__, Reload_OD01, NULL,
new WeaponGuardCanSwapMag(
this)));
510 m_fsm.AddTransition(
new WeaponTransition( Reload_OD01, _fin_, CC01, NULL,
new WeaponGuardCurrentChamberEmpty(
this)));
512 Reload_OD01.AddTransition(
new WeaponTransition(Reload_OD01.m_start, _abt_, OD01));
513 Reload_OD01.AddTransition(
new WeaponTransition(Reload_OD01.m_eject, _abt_, OD01));
514 Reload_OD01.AddTransition(
new WeaponTransition(Reload_OD01.m_detach, _abt_, OD01));
515 Reload_OD01.AddTransition(
new WeaponTransition(Reload_OD01.m_hideOld, _abt_, OD00));
516 Reload_OD01.AddTransition(
new WeaponTransition(Reload_OD01.m_swapMags, _abt_, OD01));
517 Reload_OD01.AddTransition(
new WeaponTransition(Reload_OD01.m_attach, _abt_, OD01));
518 Reload_OD01.AddTransition(
new WeaponTransition(Reload_OD01.m_onCK, _abt_, CC01));
519 Reload_OD01.AddTransition(
new WeaponTransition(Reload_OD01.m_chamber, _abt_, CC11));
521 m_fsm.AddTransition(
new WeaponTransition( CJF1, __S__, Reload_CJF1, NULL,
new WeaponGuardCanSwapMag(
this)));
523 m_fsm.AddTransition(
new WeaponTransition( Reload_CJF1, _abt_, CC11, NULL,
new WeaponGuardCurrentChamberFull(
this)) );
524 m_fsm.AddTransition(
new WeaponTransition( Reload_CJF1, _abt_, CC01, NULL,
new WeaponGuardHasMag(
this)) );
529 m_fsm.AddTransition(
new WeaponTransition( OD01, __D__, Detach_OD01, NULL,
new WeaponGuardCanDetachMag(
this)));
531 m_fsm.AddTransition(
new WeaponTransition( Detach_OD01, _abt_, OD01, NULL,
new WeaponGuardHasMag(
this)));
534 m_fsm.AddTransition(
new WeaponTransition( CC11, __D__, Detach_CC11, NULL,
new WeaponGuardCanDetachMag(
this)));
536 m_fsm.AddTransition(
new WeaponTransition( Detach_CC11, _abt_, CC11, NULL,
new WeaponGuardHasMag(
this)));
539 m_fsm.AddTransition(
new WeaponTransition( CC01, __D__, Detach_CC01, NULL,
new WeaponGuardCanDetachMag(
this)));
541 m_fsm.AddTransition(
new WeaponTransition( Detach_CC01, _abt_, CC01, NULL,
new WeaponGuardHasMag(
this)));
544 m_fsm.AddTransition(
new WeaponTransition( CD01, __D__, Detach_CD01, NULL,
new WeaponGuardCanDetachMag(
this)));
546 m_fsm.AddTransition(
new WeaponTransition( Detach_CD01, _abt_, CD01, NULL,
new WeaponGuardHasMag(
this)));
549 m_fsm.AddTransition(
new WeaponTransition( CJF1, __D__, Detach_CJF1, NULL,
new WeaponGuardCanDetachMag(
this)));
551 m_fsm.AddTransition(
new WeaponTransition( Detach_CJF1, _abt_, CJF1, NULL,
new WeaponGuardHasMag(
this)));
557 m_fsm.AddTransition(
new WeaponTransition( Unjam_CJF0, _fin_, CJF0, NULL,
new WeaponGuardJammed(
this)));
558 m_fsm.AddTransition(
new WeaponTransition( Unjam_CJF0, _fin_, CC00, NULL,
new GuardNot(
new WeaponGuardJammed(
this))));
562 m_fsm.AddTransition(
new WeaponTransition( Unjam_CJF1, _fin_, CJF1, NULL,
new WeaponGuardJammed(
this)));
563 m_fsm.AddTransition(
new WeaponTransition( Unjam_CJF1, _fin_, CC01, NULL,
new WeaponGuardCurrentChamberEmpty(
this)));
565 m_fsm.AddTransition(
new WeaponTransition( Unjam_CJF1, _abt_, CJF1, NULL,
new WeaponGuardJammed(
this)));
566 m_fsm.AddTransition(
new WeaponTransition( Unjam_CJF1, _abt_, CC01, NULL,
new WeaponGuardCurrentChamberEmpty(
this)));
570 SetInitialState(CD00);
571 SelectionBulletHide();
578 float chanceToJam = super.GetChanceToJam();
579 Magazine mag = GetMagazine(GetCurrentMuzzle());
583 chanceToJam = chanceToJam + ((1.0 - chanceToJam) * mag.GetChanceToJam());
587 chanceToJam = chanceToJam + ((1.0 - chanceToJam) * 0.06);
void AddAction(typename actionName)
void WeaponGuardHasAmmo(Weapon_Base w=NULL)
@ CLOSED_CHARGED
closed and charged
@ DEFAULT
default weapon state, closed and discharged
@ OPENED_DISCHARGED
opened and discharged
class SSPFireout extends WeaponStableState OnEntry
enum FSMTransition WeaponTransition
ref array< MuzzleState > m_muzzleHasBullet
pair ( action, actionType )
static bool IsWeaponLogEnable()
base for semi auto weapons @NOTE name copies config base class
ref WeaponStableState CC01
ref WeaponStableState CC00
ref WeaponStableState CC10
override float GetChanceToJam()
override void InitStateMachine()
ref WeaponStableState CD00
ref WeaponStableState CD01
ref WeaponStableState CJF0
override bool CanChamberBullet(int muzzleIndex, Magazine mag)
ref WeaponStableState CC11
ref WeaponStableState CJF1
ref WeaponStableState OD01
ref WeaponStableState OD00
override void SetActions()
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)
override bool IsBoltOpen()
override bool IsRepairEnabled()
override void OnEntry(WeaponEventBase e)
override int GetCurrentStateID()
override void OnExit(WeaponEventBase e)
override bool HasBullet()
override void InitMuzzleArray()
override bool HasMagazine()
represent weapon state base
handle jamming state set jam/unjam state for weapon
override bool IsBoltOpen()
override bool IsRepairEnabled()
override void OnEntry(WeaponEventBase e)
override int GetCurrentStateID()
override void OnExit(WeaponEventBase e)
override bool HasBullet()
override void InitMuzzleArray()
override bool HasMagazine()
WeaponActionChamberingTypes
WeaponActionUnjammingTypes