34 magnum.SyncCylinderRotation();
128 m_fsm.AddTransition(
new WeaponTransition(
C, __L__, Chamber, null,
new WeaponGuardAnyChamberFiredOut(
this)));
144 m_fsm.AddTransition(
new WeaponTransition(
C, __T__, Trigger_normal, null,
new GuardAnd (
new WeaponGuardCurrentChamberFull(
this),
new GuardNot(
new WeaponGuardCurrentChamberFiredOut(
this))) ));
156 SelectionBulletHide();
164 if ( CanChamberFromMag(muzzleIndex, mag) )
166 if (IsChamberEmpty(muzzleIndex))
181 ForceSyncSelectionState();
189 GetInventory().CreateAttachment(
"Magnum_Ejector");
194 GetInventory().CreateAttachment(
"Magnum_Cylinder");
216 ErrorEx(
string.Format(
"Invalid muzzle index: %1", muzzleIndex));
223 Magnum_Cylinder cylinder = Magnum_Cylinder.Cast(GetAttachmentByType(Magnum_Cylinder));
224 Magnum_Ejector ejector = Magnum_Ejector.Cast(GetAttachmentByType(Magnum_Ejector));
225 if (cylinder && ejector)
227 float anim_phase = cylinder.GetAnimationPhase(
"Rotate_Cylinder");
232 cylinder.ResetAnimationPhase(
"Rotate_Cylinder", rot );
233 ejector.ResetAnimationPhase(
"Rotate_Ejector", rot );
241 cylinder.SetAnimationPhase(
"Rotate_Cylinder", rot );
242 ejector.SetAnimationPhase(
"Rotate_Ejector", rot );
254 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
267 for (
int i = 0; i < GetInventory().AttachmentCount(); i++)
269 entity = GetInventory().GetAttachmentFromIndex(i);
272 attachment.SetHealth01(
"",
"Health",GetHealth01());
279 super.OnFire(muzzle_index);
280 Magnum_Cylinder cylinder = Magnum_Cylinder.Cast(GetAttachmentByType(Magnum_Cylinder));
283 string bullet_nose =
"bullet_nose";
284 if (muzzle_index > 0)
285 bullet_nose =
string.
Format(
"bullet_nose_" + (muzzle_index + 1));
286 cylinder.HideSelection(bullet_nose);
297 for (
int i = 0; i < GetMuzzleCount(); i++)
307 Magnum_Cylinder cylinder = Magnum_Cylinder.Cast(GetAttachmentByType(Magnum_Cylinder));
310 string bullet =
"bullet";
312 bullet =
string.
Format(
"bullet_" + (muzzleIndex + 1));
314 cylinder.ShowSelection(bullet);
318 string bullet_nose =
"bullet_nose";
320 bullet_nose =
string.
Format(
"bullet_nose_" + (muzzleIndex + 1));
321 cylinder.ShowSelection(bullet_nose);
328 super.HideBullet(muzzleIndex);
330 Magnum_Cylinder cylinder = Magnum_Cylinder.Cast(GetAttachmentByType(Magnum_Cylinder));
333 string bullet =
"bullet";
335 bullet =
string.
Format(
"bullet_" + (muzzleIndex + 1));
337 cylinder.HideSelection(bullet);
339 string bullet_nose =
"bullet_nose";
341 bullet_nose =
string.
Format(
"bullet_nose_" + (muzzleIndex + 1));
342 cylinder.HideSelection(bullet_nose);
349 super.OnDebugSpawn();
354 entity.SpawnEntityOnGroundPos(
"Ammo_357", entity.GetPosition());
367 super.GetDebugActions(outputList);
376 const float animPhaseOffset = 0.167;
378 Magnum_Cylinder cylinder = Magnum_Cylinder.Cast(GetAttachmentByType(Magnum_Cylinder));
379 Magnum_Ejector ejector = Magnum_Ejector.Cast(GetAttachmentByType(Magnum_Ejector));
383 float animPhase = cylinder.GetAnimationPhase(
"Rotate_Cylinder");
384 if (animPhase + animPhaseOffset > 1.0)
387 cylinder.ResetAnimationPhase(
"Rotate_Cylinder", animPhase);
388 ejector.ResetAnimationPhase(
"Rotate_Ejector", animPhase);
391 cylinder.SetAnimationPhase(
"Rotate_Cylinder", animPhase);
392 ejector.ResetAnimationPhase(
"Rotate_Ejector", animPhase);
397 return super.OnAction(action_id, player, ctx);
406 if ( !FindAttachmentBySlotName(ATT_SLOT_EJECTOR) )
408 GetInventory().CreateAttachment(
"Magnum_Ejector_Gold");
411 if ( !FindAttachmentBySlotName(ATT_SLOT_CYLINDER) )
413 GetInventory().CreateAttachment(
"Magnum_Cylinder_Gold");
421 if ( !FindAttachmentBySlotName(ATT_SLOT_EJECTOR) )
423 GetInventory().CreateAttachment(
"Magnum_Ejector_Gold");
426 if ( !FindAttachmentBySlotName(ATT_SLOT_CYLINDER) )
428 GetInventory().CreateAttachment(
"Magnum_Cylinder_Gold");
433class Magnum_Cylinder
extends DummyItem {};
434class Magnum_Ejector
extends DummyItem {};
Param4< int, int, string, int > TSelectableActionInfoWithColor
void AddAction(typename actionName)
@ UNKNOWN
24 - Any other error. Can be returned from any call.
class WeaponGuardIsDestroyed extends WeaponGuardBase m_weapon
enum MagnumStableStateID init
const float MAGNUM_ROTATION_POSITION_2
const float MAGNUM_ROTATION_POSITION_1
const float MAGNUM_ROTATION_POSITION_3
const float MAGNUM_ROTATION_POSITION_4
const float MAGNUM_ROTATION_POSITION_6
const float MAGNUM_ROTATION_POSITION_M1
const float MAGNUM_ROTATION_POSITION_5
const float MAGNUM_ROTATION_POSITION_0
class SSPFireout extends WeaponStableState OnEntry
enum FSMTransition WeaponTransition
class WeaponChambering_Chamber_OnEntry extends WeaponChambering_Base OnExit
bool IsSingleState()
Special one for when the weapon only has one singular state (like Magnum)
bool IsChamberFiredOut(int idx)
bool IsChamberFull(int idx)
pair ( action, actionType )
Super root of all classes in Enforce script.
static bool IsWeaponLogEnable()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void SetGunParts()
override void SetGunParts()
override void InitStateMachine()
const string ATT_SLOT_EJECTOR
override void HideBullet(int muzzleIndex)
override RecoilBase SpawnRecoilObject()
override bool IsShowingChamberedBullet()
override void ShowBullet(int muzzleIndex)
override void AssembleGun()
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void SetActions()
void SyncCylinderRotation(bool reset=true)
override bool CanEjectBullet()
static float GetCylinderRotation(int muzzleIndex)
override bool CanChamberBullet(int muzzleIndex, Magazine mag)
override void OnFire(int muzzle_index)
const string ATT_SLOT_CYLINDER
override void OnDebugSpawn()
void SetCylinderRotationAnimationPhase(float rot, bool reset=false)
void SetAttachmentsHealth()
override void OnExit(WeaponEventBase e)
charging of weapon without ammo to be chambered
signalize mechanism manipulation
weapon finite state machine
override void OnEntry(WeaponEventBase e)
override bool HasBullet()
override int GetCurrentStateID()
override bool HasMagazine()
represents weapon's stable state (i.e. the basic states that the weapon will spend the most time in)
represent weapon state base
Serializer ParamsReadContext
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float AbsFloat(float f)
Returns absolute value.
const int SAT_DEBUG_ACTION
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
WeaponActionChamberingTypes