public static bool CheckUseAnimationInsteadOfIK(IMyHandheldGunObject <MyDeviceBase> currentWeapon = null) { if (currentWeapon != null) { return(m_useAnimationInsteadOfIK || currentWeapon.ForceAnimationInsteadOfIK); } return(m_useAnimationInsteadOfIK); }
void gunEntity_OnClose(MyEntity obj) { if (m_leftWeapon == obj) { m_leftWeapon = null; } if (m_rightWeapon == obj) { m_rightWeapon = null; } }
private bool GetHandId(out MyDefinitionId handId) { IMyHandheldGunObject <MyDeviceBase> tool = GetHandTool(); if (tool == null) { handId = new MyDefinitionId(); return(false); } handId = tool.PhysicalItemDefinition.Id; return(true); }
public bool IsInHand() { IMyHandheldGunObject <MyDeviceBase> handTool = GetHandTool(); if (handTool == null || !IsHandType(handTool)) { return(false); } foreach (MyDefinitionId id in Ids) { if (id == handTool.PhysicalItemDefinition.Id) { return(true); } } return(false); }
void gunEntity_OnClose(MyEntity obj) { if (m_leftWeapon == obj) m_leftWeapon = null; if (m_rightWeapon == obj) m_rightWeapon = null; }
void gunEntity_OnClose(MyEntity obj) { if (m_currentWeapon == obj) m_currentWeapon = null; }
private void EquipWeapon(IMyHandheldGunObject<MyDeviceBase> newWeapon, bool showNotification = false) { // Debug.Assert(newWeapon != null); if (newWeapon == null) return; MyEntity gunEntity = (MyEntity)newWeapon; gunEntity.Render.CastShadows = true; gunEntity.Render.NeedsResolveCastShadow = false; gunEntity.Save = false; gunEntity.OnClose += gunEntity_OnClose; MyEntities.Add(gunEntity); m_handItemDefinition = null; m_currentWeapon = newWeapon; m_currentWeapon.OnControlAcquired(this); UseAnimationForWeapon |= m_currentWeapon.ForceAnimationInsteadOfIK; if (WeaponEquiped != null) WeaponEquiped(m_currentWeapon); MyAnalyticsHelper.ReportActivityStart(this, "item_equip", "character", "toolbar_item_usage", m_currentWeapon.GetType().Name); // CH:TODO: The hand item definitions should be changed to handheld gun object definitions and should be taken according to m_currentWeapon typeId if (m_currentWeapon.PhysicalObject != null) { var handItemId = m_currentWeapon.PhysicalObject.GetId(); m_handItemDefinition = MyDefinitionManager.Static.TryGetHandItemForPhysicalItem(handItemId); System.Diagnostics.Debug.Assert(m_handItemDefinition != null, "Create definition for this hand item!"); } else if (m_currentWeapon.DefinitionId.TypeId == typeof(MyObjectBuilder_CubePlacer)) { var gunID = new MyDefinitionId(typeof(MyObjectBuilder_CubePlacer)); m_handItemDefinition = MyDefinitionManager.Static.TryGetHandItemDefinition(ref gunID); System.Diagnostics.Debug.Assert(m_handItemDefinition != null, "Create definition for this hand item!"); } //Setup correct worldmatrix to weapon //CalculateDependentMatrices(); if (m_handItemDefinition != null && !string.IsNullOrEmpty(m_handItemDefinition.FingersAnimation)) { string animationSubtype; if (!m_characterDefinition.AnimationNameToSubtypeName.TryGetValue(m_handItemDefinition.FingersAnimation, out animationSubtype)) { animationSubtype = m_handItemDefinition.FingersAnimation; } var def = MyDefinitionManager.Static.TryGetAnimationDefinition(animationSubtype); if (!def.LeftHandItem.TypeId.IsNull) { m_currentWeapon.OnControlReleased(); (m_currentWeapon as MyEntity).Close(); //no dual wielding now m_currentWeapon = null; } PlayCharacterAnimation(m_handItemDefinition.FingersAnimation, MyBlendOption.Immediate, def.Loop ? MyFrameOption.Loop : MyFrameOption.PlayOnce, 1.0f, 1, false, null); if (UseNewAnimationSystem) { TriggerCharacterAnimationEvent("equip_left_tool", true); TriggerCharacterAnimationEvent("equip_right_tool", true); TriggerCharacterAnimationEvent(m_handItemDefinition.Id.SubtypeName.ToLower(), true); TriggerCharacterAnimationEvent(m_handItemDefinition.FingersAnimation.ToLower(), true); } if (!def.LeftHandItem.TypeId.IsNull) { if (m_leftHandItem != null) { (m_leftHandItem as IMyHandheldGunObject<Sandbox.Game.Weapons.MyDeviceBase>).OnControlReleased(); m_leftHandItem.Close(); } // CH: TODO: The entity id is not synced, but it never was in this place. It should be fixed later long handItemId = MyEntityIdentifier.AllocateId(); uint? inventoryItemId = null; var builder = GetObjectBuilderForWeapon(def.LeftHandItem, ref inventoryItemId, handItemId); var leftHandItem = CreateGun(builder, inventoryItemId); if (leftHandItem != null) { m_leftHandItem = leftHandItem as MyEntity; leftHandItem.OnControlAcquired(this); UpdateLeftHandItemPosition(); MyEntities.Add(m_leftHandItem); } } } else if (m_handItemDefinition != null) { if (UseNewAnimationSystem) { TriggerCharacterAnimationEvent("equip_left_tool", true); TriggerCharacterAnimationEvent("equip_right_tool", true); TriggerCharacterAnimationEvent(m_handItemDefinition.Id.SubtypeName.ToLower(), true); } } else { StopFingersAnimation(0); } var consumer = gunEntity.Components.Get<MyResourceSinkComponent>(); if (consumer != null && SuitRechargeDistributor != null) SuitRechargeDistributor.AddSink(consumer); if (showNotification) { var notificationUse = new MyHudNotification(MySpaceTexts.NotificationUsingWeaponType, 2000); notificationUse.SetTextFormatArguments(MyDeviceBase.GetGunNotificationName(newWeapon.DefinitionId)); MyHud.Notifications.Add(notificationUse); } Static_CameraAttachedToChanged(null, null); if (!(IsUsing is MyCockpit)) MyHud.Crosshair.ResetToDefault(clear: false); }
public void UnequipWeapon() { if (m_leftHandItem != null && m_leftHandItem is IMyHandheldGunObject<MyDeviceBase>) { (m_leftHandItem as IMyHandheldGunObject<MyDeviceBase>).OnControlReleased(); m_leftHandItem.Close(); // no dual wielding now m_leftHandItem = null; TriggerCharacterAnimationEvent("unequip_left_tool", true); } if (m_currentWeapon != null) { var weaponEntity = m_currentWeapon as MyEntity; SaveAmmoToWeapon(); m_currentWeapon.OnControlReleased(); var weaponSink = weaponEntity.Components.Get<MyResourceSinkComponent>(); if (weaponSink != null) SuitRechargeDistributor.RemoveSink(weaponSink); weaponEntity.OnClose -= gunEntity_OnClose; MyEntities.Remove(weaponEntity); weaponEntity.Close(); var useAnimationInsteadOfIK = MyPerGameSettings.CheckUseAnimationInsteadOfIK(m_currentWeapon); m_currentWeapon = null; if (ControllerInfo.IsLocallyHumanControlled() && MySector.MainCamera != null) { MySector.MainCamera.Zoom.ResetZoom(); } if (useAnimationInsteadOfIK) { StopUpperAnimation(0.2f); SwitchAnimation(m_currentMovementState, false); } TriggerCharacterAnimationEvent("unequip_left_tool", true); TriggerCharacterAnimationEvent("unequip_right_tool", true); MyAnalyticsHelper.ReportActivityEnd(this, "item_equip"); } if (m_currentShotTime <= 0) { //Otherwise all upper players keep updating StopUpperAnimation(0); StopFingersAnimation(0); } //MyHud.Crosshair.Hide(); m_currentWeapon = null; StopFingersAnimation(0); }
private void CloseInternal() { if (m_currentWeapon != null) { ((MyEntity)m_currentWeapon).Close(); m_currentWeapon = null; } if (m_leftHandItem != null) { m_leftHandItem.Close(); m_leftHandItem = null; } RemoveNotifications(); RadioBroadcaster.Enabled = false; if (MyToolbarComponent.CharacterToolbar != null) MyToolbarComponent.CharacterToolbar.ItemChanged -= Toolbar_ItemChanged; }
private void DisposeWeapon() { var weaponEntity = m_currentWeapon as MyEntity; Debug.Assert(weaponEntity != null); if (weaponEntity != null) { weaponEntity.EntityId = 0; weaponEntity.Close(); m_currentWeapon = null; } }
public static void LoadInventoryConfig(MyEntity toolEntity, MyAssetModifierComponent skinComponent) { if (toolEntity == null) { throw new ArgumentNullException("toolEntity"); } if (skinComponent == null) { throw new ArgumentNullException("skinComponent"); } if (MyGameService.IsActive) { MyObjectBuilder_SkinInventory inventory; string path = Path.Combine(MyFileSystem.SavesPath, activeInventoryFile); switch (inventory.Tools) { case ((!MyFileSystem.FileExists(path) || !MyObjectBuilderSerializer.DeserializeXML <MyObjectBuilder_SkinInventory>(path, out inventory)) || ((null) || (null))): break; default: { IMyHandheldGunObject <MyDeviceBase> obj2 = toolEntity as IMyHandheldGunObject <MyDeviceBase>; MyPhysicalItemDefinition physicalItemDefinition = obj2.PhysicalItemDefinition; MyGameInventoryItemSlot none = MyGameInventoryItemSlot.None; if (obj2 is MyHandDrill) { none = MyGameInventoryItemSlot.Drill; } else if (obj2 is MyAutomaticRifleGun) { none = MyGameInventoryItemSlot.Rifle; } else if (obj2 is MyWelder) { none = MyGameInventoryItemSlot.Welder; } else if (obj2 is MyAngleGrinder) { none = MyGameInventoryItemSlot.Grinder; } if (none != MyGameInventoryItemSlot.None) { List <MyGameInventoryItem> items = new List <MyGameInventoryItem>(); using (List <ulong> .Enumerator enumerator = inventory.Tools.GetEnumerator()) { while (enumerator.MoveNext()) { MyGameInventoryItem item = MyGameService.InventoryItems.FirstOrDefault <MyGameInventoryItem>(delegate(MyGameInventoryItem i) { ulong itemId; return(i.ID == itemId); }); if ((item != null) && ((physicalItemDefinition != null) && ((physicalItemDefinition == null) || (item.ItemDefinition.ItemSlot == none)))) { item.IsInUse = true; items.Add(item); } } } MyGameService.GetItemsCheckData(items, checkDataResult => skinComponent.TryAddAssetModifier(checkDataResult)); } break; } } } }
protected override bool IsHandType(IMyHandheldGunObject <MyDeviceBase> handTool) { return(true); }
private void SwitchWeapon(ref IMyHandheldGunObject<MyDeviceBase> weapon, ref MyVRWeaponInfo weaponInfo, List<MyVRWeaponInfo> weapons, ControllerRole role, Vector2? touchpadPos) { int currentIndex = -1; if (weapon != null) { for (int i = 0; i < weapons.Count; ++i) { var info = weapons[i]; if (info.DefinitionId == weapon.DefinitionId) { currentIndex = i; break; } } } int nextIndex = 0; if (touchpadPos != null) { Vector2 pos = touchpadPos.Value; if (touchpadPos != Vector2.Zero) { pos.Normalize(); float anglePerWeaponSector = 360f / weapons.Count; float dot = Vector2.Dot(Vector2.UnitX, pos); float angle = (float)Math.Acos(Math.Abs(dot)); if (pos.Y >= 0) { if (dot < 0) angle = 180 - angle; } else { if (dot < 0) angle = 180 + angle; else angle = 360 - angle; } nextIndex = (int)Math.Floor(angle / anglePerWeaponSector); Debug.Assert(nextIndex < weapons.Count); } } if (nextIndex == currentIndex) return; if (weapon != null) { weapon.OnControlReleased(); MyEntity weaponEntity = (MyEntity)weapon; weaponEntity.Close(); weapon = null; } { weaponInfo = weapons[nextIndex]; weapon = CreateWeapon(weaponInfo.DefinitionId, weaponInfo.Reference); weapon.OnControlAcquired(null); MyEntity weaponEntity = (MyEntity)weapon; } var gunBase = weapon.GunBase as MyGunBase; Matrix holdingMatrix = gunBase != null ? gunBase.m_holdingDummyMatrix : Matrix.Identity; MyOpenVR.LMUAdd(holdingMatrix, m_worldMatrixOriginal, role, weaponInfo.Reference); }
void HandleButtons(ref IMyHandheldGunObject<MyDeviceBase> weapon, ref MyVRWeaponInfo weaponInfo, bool secondController, List<MyVRWeaponInfo> weapons) { if (weapon == null) return; MyWeaponSharedActionsComponentBase sharedWeaponActionsComponent = null; ((MyEntity)weapon).Components.TryGet<MyWeaponSharedActionsComponentBase>(out sharedWeaponActionsComponent); if (sharedWeaponActionsComponent != null) sharedWeaponActionsComponent.Update(); if (MyOpenVR.GetControllerState(secondController).IsButtonPressed(EVRButtonId.k_EButton_SteamVR_Trigger)) {//holding the trigger var gunBase = weapon.GunBase as MyGunBase; MyGunStatusEnum status; weapon.CanShoot(MyShootActionEnum.PrimaryAction, this.EntityId, out status); if (status != MyGunStatusEnum.Cooldown && status != MyGunStatusEnum.BurstLimit) { weapon.Shoot(MyShootActionEnum.PrimaryAction, gunBase != null ? (Vector3)gunBase.GetMuzzleWorldMatrix().Forward : Vector3.Forward, null); if (sharedWeaponActionsComponent != null) sharedWeaponActionsComponent.Shoot(MyShootActionEnum.PrimaryAction); } } if (MyOpenVR.GetControllerState(secondController).WasButtonReleased(EVRButtonId.k_EButton_SteamVR_Trigger)) { weapon.EndShoot(MyShootActionEnum.PrimaryAction); if (sharedWeaponActionsComponent != null) sharedWeaponActionsComponent.EndShoot(MyShootActionEnum.PrimaryAction); } if (MyOpenVR.GetControllerState(secondController).WasButtonPressed(EVRButtonId.k_EButton_Grip)) { var gunBase = weapon.GunBase as MyGunBase; weapon.Shoot(MyShootActionEnum.SecondaryAction, gunBase != null ? (Vector3)gunBase.GetMuzzleWorldMatrix().Forward : Vector3.Forward, null); if (sharedWeaponActionsComponent != null) sharedWeaponActionsComponent.Shoot(MyShootActionEnum.SecondaryAction); } if (MyOpenVR.GetControllerState(secondController).WasButtonReleased(EVRButtonId.k_EButton_Grip)) { weapon.EndShoot(MyShootActionEnum.SecondaryAction); if (sharedWeaponActionsComponent != null) sharedWeaponActionsComponent.EndShoot(MyShootActionEnum.SecondaryAction); } if (MyOpenVR.GetControllerState(secondController).WasButtonPressed(EVRButtonId.k_EButton_ApplicationMenu)) { var gunBase = weapon.GunBase as MyGunBase; weapon.Shoot(MyShootActionEnum.TertiaryAction, gunBase != null ? (Vector3)gunBase.GetMuzzleWorldMatrix().Forward : Vector3.Forward, null); if (sharedWeaponActionsComponent != null) sharedWeaponActionsComponent.Shoot(MyShootActionEnum.TertiaryAction); } if (MyOpenVR.GetControllerState(secondController).WasButtonReleased(EVRButtonId.k_EButton_ApplicationMenu)) { weapon.EndShoot(MyShootActionEnum.TertiaryAction); if (sharedWeaponActionsComponent != null) sharedWeaponActionsComponent.EndShoot(MyShootActionEnum.TertiaryAction); } Vector2 touchpadPos = Vector2.Zero; bool validTouchpadPos = false; validTouchpadPos = MyOpenVR.GetControllerState(secondController).GetTouchpadXY(ref touchpadPos); if (MyOpenVR.GetControllerState(secondController).WasButtonPressed(EVRButtonId.k_EButton_SteamVR_Touchpad)) { SwitchWeapon(ref weapon, ref weaponInfo, weapons, secondController ? ControllerRole.rightHand : ControllerRole.leftHand, validTouchpadPos ? touchpadPos : (Vector2?)null); } else { if (validTouchpadPos) { if (weapon is ITouchPadListener) (weapon as ITouchPadListener).TouchPadChanged(touchpadPos); } } }
private void Handler(object target, ref MyDamageInformation info) { IMySlimBlock block = target as IMySlimBlock; if (block == null) { return; // End: Only reduce damage to blocks } IMyEntity ent = MyAPIGateway.Entities.GetEntityById(info.AttackerId); if (ent == null) { return; // End: Must be a player character } IMyHandheldGunObject <MyToolBase> tool = null; IMyHandheldGunObject <MyGunBase> gun = null; if (info.Type == MyDamageType.Grind) { tool = ent as IMyAngleGrinder; } else if (info.Type == MyDamageType.Drill) { tool = ent as IMyHandDrill; } else { gun = ent as IMyAutomaticRifleGun; } if (tool == null && gun == null) { return; // End: damage must be done by tool or hand weapon } bool isTool = tool != null; long identity = (isTool) ? tool.OwnerIdentityId : gun.OwnerIdentityId; List <IMyPlayer> players = new List <IMyPlayer>(); MyAPIGateway.Players.GetPlayers(players, p => p.IdentityId == identity); if (players.Count == 0 || // End: Player not found. this can happen if the character is an NPC block.CubeGrid.BigOwners.Count == 0) { return; // End: Unowned structures take full damage } MyRelationsBetweenPlayerAndBlock relation = players[0].GetRelationTo(block.CubeGrid.BigOwners[0]); if (!(relation == MyRelationsBetweenPlayerAndBlock.Enemies || relation == MyRelationsBetweenPlayerAndBlock.Neutral)) { return; // End: Friendly and unowned structures take full damage } if (block.FatBlock != null && block.FatBlock is IMyTerminalBlock) { if (block.FatBlock.OwnerId != 0) { info.Amount = info.Amount * (1 + (1 - MyAPIGateway.Session.HackSpeedMultiplier)) * GetTerminalBlockHackSpeedAboveFunctional(isTool); } else { info.Amount = info.Amount * GetTerminalBlockHackSpeedBelowFunctional(isTool); } } else { info.Amount = info.Amount * GetNonTerminalBlockHackSpeed(isTool); } }
protected override bool IsHandType(IMyHandheldGunObject <MyDeviceBase> handTool) { return(handTool is IMyAutomaticRifleGun); }
private void SwitchWeapon(ref IMyHandheldGunObject <MyDeviceBase> weapon, ref MyVRWeaponInfo weaponInfo, List <MyVRWeaponInfo> weapons, ControllerRole role, Vector2?touchpadPos) { int currentIndex = -1; if (weapon != null) { for (int i = 0; i < weapons.Count; ++i) { var info = weapons[i]; if (info.DefinitionId == weapon.DefinitionId) { currentIndex = i; break; } } } int nextIndex = 0; if (touchpadPos != null) { Vector2 pos = touchpadPos.Value; if (touchpadPos != Vector2.Zero) { pos.Normalize(); float anglePerWeaponSector = 360f / weapons.Count; float dot = Vector2.Dot(Vector2.UnitX, pos); float angle = (float)Math.Acos(Math.Abs(dot)); if (pos.Y >= 0) { if (dot < 0) { angle = 180 - angle; } } else { if (dot < 0) { angle = 180 + angle; } else { angle = 360 - angle; } } nextIndex = (int)Math.Floor(angle / anglePerWeaponSector); Debug.Assert(nextIndex < weapons.Count); } } if (nextIndex == currentIndex) { return; } if (weapon != null) { weapon.OnControlReleased(); MyEntity weaponEntity = (MyEntity)weapon; weaponEntity.Close(); weapon = null; } { weaponInfo = weapons[nextIndex]; weapon = CreateWeapon(weaponInfo.DefinitionId, weaponInfo.Reference); weapon.OnControlAcquired(null); MyEntity weaponEntity = (MyEntity)weapon; } var gunBase = weapon.GunBase as MyGunBase; Matrix holdingMatrix = gunBase != null ? gunBase.m_holdingDummyMatrix : Matrix.Identity; MyOpenVR.LMUAdd(holdingMatrix, m_worldMatrixOriginal, role, weaponInfo.Reference); }
void HandleButtons(ref IMyHandheldGunObject <MyDeviceBase> weapon, ref MyVRWeaponInfo weaponInfo, bool secondController, List <MyVRWeaponInfo> weapons) { if (weapon == null) { return; } MyWeaponSharedActionsComponentBase sharedWeaponActionsComponent = null; ((MyEntity)weapon).Components.TryGet <MyWeaponSharedActionsComponentBase>(out sharedWeaponActionsComponent); if (sharedWeaponActionsComponent != null) { sharedWeaponActionsComponent.Update(); } if (MyOpenVR.GetControllerState(secondController).IsButtonPressed(EVRButtonId.k_EButton_SteamVR_Trigger)) {//holding the trigger var gunBase = weapon.GunBase as MyGunBase; MyGunStatusEnum status; weapon.CanShoot(MyShootActionEnum.PrimaryAction, this.EntityId, out status); if (status != MyGunStatusEnum.Cooldown && status != MyGunStatusEnum.BurstLimit) { weapon.Shoot(MyShootActionEnum.PrimaryAction, gunBase != null ? (Vector3)gunBase.GetMuzzleWorldMatrix().Forward : Vector3.Forward, null); if (sharedWeaponActionsComponent != null) { sharedWeaponActionsComponent.Shoot(MyShootActionEnum.PrimaryAction); } } } if (MyOpenVR.GetControllerState(secondController).WasButtonReleased(EVRButtonId.k_EButton_SteamVR_Trigger)) { weapon.EndShoot(MyShootActionEnum.PrimaryAction); if (sharedWeaponActionsComponent != null) { sharedWeaponActionsComponent.EndShoot(MyShootActionEnum.PrimaryAction); } } if (MyOpenVR.GetControllerState(secondController).WasButtonPressed(EVRButtonId.k_EButton_Grip)) { var gunBase = weapon.GunBase as MyGunBase; weapon.Shoot(MyShootActionEnum.SecondaryAction, gunBase != null ? (Vector3)gunBase.GetMuzzleWorldMatrix().Forward : Vector3.Forward, null); if (sharedWeaponActionsComponent != null) { sharedWeaponActionsComponent.Shoot(MyShootActionEnum.SecondaryAction); } } if (MyOpenVR.GetControllerState(secondController).WasButtonReleased(EVRButtonId.k_EButton_Grip)) { weapon.EndShoot(MyShootActionEnum.SecondaryAction); if (sharedWeaponActionsComponent != null) { sharedWeaponActionsComponent.EndShoot(MyShootActionEnum.SecondaryAction); } } if (MyOpenVR.GetControllerState(secondController).WasButtonPressed(EVRButtonId.k_EButton_ApplicationMenu)) { var gunBase = weapon.GunBase as MyGunBase; weapon.Shoot(MyShootActionEnum.TertiaryAction, gunBase != null ? (Vector3)gunBase.GetMuzzleWorldMatrix().Forward : Vector3.Forward, null); if (sharedWeaponActionsComponent != null) { sharedWeaponActionsComponent.Shoot(MyShootActionEnum.TertiaryAction); } } if (MyOpenVR.GetControllerState(secondController).WasButtonReleased(EVRButtonId.k_EButton_ApplicationMenu)) { weapon.EndShoot(MyShootActionEnum.TertiaryAction); if (sharedWeaponActionsComponent != null) { sharedWeaponActionsComponent.EndShoot(MyShootActionEnum.TertiaryAction); } } Vector2 touchpadPos = Vector2.Zero; bool validTouchpadPos = false; validTouchpadPos = MyOpenVR.GetControllerState(secondController).GetTouchpadXY(ref touchpadPos); if (MyOpenVR.GetControllerState(secondController).WasButtonPressed(EVRButtonId.k_EButton_SteamVR_Touchpad)) { SwitchWeapon(ref weapon, ref weaponInfo, weapons, secondController ? ControllerRole.rightHand : ControllerRole.leftHand, validTouchpadPos ? touchpadPos : (Vector2?)null); } else { if (validTouchpadPos) { if (weapon is ITouchPadListener) { (weapon as ITouchPadListener).TouchPadChanged(touchpadPos); } } } }
protected abstract bool IsHandType(IMyHandheldGunObject <MyDeviceBase> handTool);
private void InitWeapon(MyObjectBuilder_EntityBase weapon) { if (weapon == null) return; if ((m_rightHandItemBone == -1 || weapon != null) && m_currentWeapon != null) { // First, dispose of the old weapon DisposeWeapon(); } var physicalItemDefinition = MyDefinitionManager.Static.GetPhysicalItemForHandItem(weapon.GetId()); Debug.Assert(this.GetInventory() != null); bool canEquipWeapon = physicalItemDefinition != null && (!MySession.Static.SurvivalMode || (this.GetInventory().GetItemAmount(physicalItemDefinition.Id) > 0)); if (m_rightHandItemBone != -1 && canEquipWeapon) { m_currentWeapon = CreateGun(weapon); } }
protected override bool IsHandType(IMyHandheldGunObject <MyDeviceBase> handTool) { return(handTool is IMyAngleGrinder); }
public static bool CheckUseAnimationInsteadOfIK(IMyHandheldGunObject<MyDeviceBase> currentWeapon = null) { if (currentWeapon != null) return m_useAnimationInsteadOfIK || currentWeapon.ForceAnimationInsteadOfIK; return m_useAnimationInsteadOfIK; }