/// <summary> /// Clear inventory cheat enabled /// </summary> static void ClearInventoryEnabled(MyGameplayCheat cheat) { if (MySession.PlayerShip != null) { MySession.PlayerShip.Inventory.ClearInventoryItems(true); } }
/// <summary> /// Remove all blueprints cheat implementation /// </summary> static void RemoveAllBluePrintsEnabled(MyGameplayCheat cheat) { if (MyGuiScreenGamePlay.Static != null) { MyGuiScreenGamePlay.Static.RemoveAllBlueprints(); } }
/// <summary> /// Kill all cheat implementation /// </summary> static void KillAllEnabled(MyGameplayCheat cheat) { // We need player ship to recognize friends if (MySession.PlayerShip == null) { return; } foreach (var entity in MyEntities.GetEntities().ToArray()) { MySmallShip smallShip = entity as MySmallShip; if (smallShip != null && smallShip.Visible && smallShip != MySession.PlayerShip && MyFactions.GetFactionsRelation(MySession.PlayerShip, smallShip) == MyFactionRelationEnum.Enemy) { entity.DoDamage(0, 1000000, 0, MyDamageType.Unknown, MyAmmoType.Unknown, null); } MyPrefabContainer container = entity as MyPrefabContainer; if (container != null && MyFactions.GetFactionsRelation(MySession.PlayerShip, container) == MyFactionRelationEnum.Enemy) { foreach (var prefab in container.GetPrefabs().ToArray()) { MyPrefabLargeWeapon largeWeapon = prefab as MyPrefabLargeWeapon; if (largeWeapon != null) { prefab.DoDamage(0, 1000000, 0, MyDamageType.Unknown, MyAmmoType.Unknown, null); } } } } }
/// <summary> /// Extra money cheat implementation /// </summary> static void ExtraMoneyEnabled(MyGameplayCheat cheat) { if (MySession.Static != null && MySession.Static.Player != null) { MySession.Static.Player.Money += 1000000; } }
public static void EnableCheat(MyGameplayCheatsEnum cheat, bool enable) { MyGameplayCheat?foundedCheatItem = GetCheat(cheat); Debug.Assert(foundedCheatItem != null); MyGameplayCheat cheatItem = foundedCheatItem.Value; if (enable) { m_enabledCheats |= cheat; if (cheatItem.OnCheatEnabled != null) { cheatItem.OnCheatEnabled(cheatItem); } } else { m_enabledCheats &= ~cheat; if (cheatItem.OnCheatDisabled != null) { cheatItem.OnCheatDisabled(cheatItem); } } }
/// <summary> /// Clear inventory cheat enabled /// </summary> static void FFInInventoryEnabled(MyGameplayCheat cheat) { if (MySession.PlayerShip != null) { if (!MySession.PlayerShip.Inventory.Contains(MyMwcObjectBuilderTypeEnum.PrefabFoundationFactory, (int)MyMwcObjectBuilder_PrefabFoundationFactory_TypesEnum.DEFAULT)) { MySession.PlayerShip.Inventory.AddInventoryItem(MyMwcObjectBuilderTypeEnum.PrefabFoundationFactory, (int)MyMwcObjectBuilder_PrefabFoundationFactory_TypesEnum.DEFAULT, 1.0f, true); } } }
/// <summary> /// Disabled increase cargo capacity cheat implementation /// </summary> /// <param name="cheat"></param> static void IncreaseCargoCapacityDisabled(MyGameplayCheat cheat) { if (MySession.PlayerShip == null) { return; } MySession.PlayerShip.Inventory.MaxItems = MySession.PlayerShip.ShipTypeProperties.GamePlay.CargoCapacity; //MySession.PlayerShip.Inventory.UnlimitedCapacity = false; }
/// <summary> /// Enable increase cargo capacity cheat implementation /// </summary> /// <param name="cheat"></param> static void IncreaseCargoCapacityEnabled(MyGameplayCheat cheat) { if (MySession.PlayerShip == null) { return; } //MySession.PlayerShip.Inventory.UnlimitedCapacity = true; MySession.PlayerShip.Inventory.MaxItems = MyGamePlayCheatsConstants.CHEAT_INCREASE_CARGO_CAPACITY_MAX_ITEMS; }
/// <summary> /// All weapons cheat implementation /// </summary> static void AllWeaponsEnabled(MyGameplayCheat cheat) { if (MySession.PlayerShip == null) { return; } List <MyMwcObjectBuilder_SmallShip_Weapon> weapons = new List <MyMwcObjectBuilder_SmallShip_Weapon>(); List <MyMwcObjectBuilder_AssignmentOfAmmo> ammoAssignment = new List <MyMwcObjectBuilder_AssignmentOfAmmo>(); List <MyMwcObjectBuilder_InventoryItem> inventoryItems = new List <MyMwcObjectBuilder_InventoryItem>(); // weapons foreach (MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum weapon in Enum.GetValues(typeof(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum))) { weapons.Add(new MyMwcObjectBuilder_SmallShip_Weapon(weapon)); // we want have 2x autocanon if (weapon == MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Autocanon) { weapons.Add(new MyMwcObjectBuilder_SmallShip_Weapon(weapon)); } } // ammo assignment ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Primary, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_Basic)); ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Secondary, MyMwcObjectBuilder_AmmoGroupEnum.Missile, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_Basic)); ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Third, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Mine_Basic)); ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Fourth, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Mine_Smart)); ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Fifth, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_Basic)); MySession.PlayerShip.Weapons.Init(weapons, ammoAssignment); foreach (MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammo in Enum.GetValues(typeof(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum))) { MyMwcObjectBuilder_InventoryItem item = new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(ammo), MyGameplayConstants.GetGameplayProperties(MyMwcObjectBuilderTypeEnum.SmallShip_Ammo, (int)ammo, MySession.PlayerShip.Faction).MaxAmount); if (!MySession.PlayerShip.Inventory.IsFull) { MySession.PlayerShip.Inventory.AddInventoryItem(MyInventory.CreateInventoryItemFromInventoryItemObjectBuilder(item)); } } }
void AddCheat(MyGameplayCheat cheat) { bool enabled = MyGuiScreenGamePlay.Static.CheatsEnabled() && cheat.IsImplemented; MyGuiControlBase control; if (cheat.IsButton) { if (!m_lastWasButton) m_currentPosition.Y += 0.005f * m_scale; m_lastWasButton = true; control = AddButton(MyTextsWrapper.Get(cheat.CheatName), onCheatButtonClick, textColor: Vector4.One, size: new Vector2(0.20f, 0.04f)); } else { if (m_lastWasButton) m_currentPosition.Y += 0.005f * m_scale; m_lastWasButton = false; control = AddCheckBox(cheat.CheatName, MyGameplayCheats.IsCheatEnabled(cheat.CheatEnum), OnCheatCheckedChanged, enabled, color: Vector4.One); } control.UserData = cheat; control.Enabled = enabled; }
/// <summary> /// All weapons cheat implementation /// </summary> static void AllWeaponsEnabled(MyGameplayCheat cheat) { if (MySession.PlayerShip == null) return; List<MyMwcObjectBuilder_SmallShip_Weapon> weapons = new List<MyMwcObjectBuilder_SmallShip_Weapon>(); List<MyMwcObjectBuilder_AssignmentOfAmmo> ammoAssignment = new List<MyMwcObjectBuilder_AssignmentOfAmmo>(); List<MyMwcObjectBuilder_InventoryItem> inventoryItems = new List<MyMwcObjectBuilder_InventoryItem>(); // weapons foreach (MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum weapon in Enum.GetValues(typeof(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum))) { weapons.Add(new MyMwcObjectBuilder_SmallShip_Weapon(weapon)); // we want have 2x autocanon if (weapon == MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Autocanon) { weapons.Add(new MyMwcObjectBuilder_SmallShip_Weapon(weapon)); } } // ammo assignment ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Primary, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_Basic)); ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Secondary, MyMwcObjectBuilder_AmmoGroupEnum.Missile, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_Basic)); ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Third, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Mine_Basic)); ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Fourth, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Mine_Smart)); ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Fifth, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_Basic)); MySession.PlayerShip.Weapons.Init(weapons, ammoAssignment); foreach (MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammo in Enum.GetValues(typeof(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum))) { MyMwcObjectBuilder_InventoryItem item = new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(ammo), MyGameplayConstants.GetGameplayProperties(MyMwcObjectBuilderTypeEnum.SmallShip_Ammo, (int)ammo, MySession.PlayerShip.Faction).MaxAmount); if(!MySession.PlayerShip.Inventory.IsFull) MySession.PlayerShip.Inventory.AddInventoryItem(MyInventory.CreateInventoryItemFromInventoryItemObjectBuilder(item)); } }
/// <summary> /// Disabled increase cargo capacity cheat implementation /// </summary> /// <param name="cheat"></param> static void IncreaseCargoCapacityDisabled(MyGameplayCheat cheat) { if (MySession.PlayerShip == null) return; MySession.PlayerShip.Inventory.MaxItems = MySession.PlayerShip.ShipTypeProperties.GamePlay.CargoCapacity; //MySession.PlayerShip.Inventory.UnlimitedCapacity = false; }
/// <summary> /// Enable increase cargo capacity cheat implementation /// </summary> /// <param name="cheat"></param> static void IncreaseCargoCapacityEnabled(MyGameplayCheat cheat) { if (MySession.PlayerShip == null) return; //MySession.PlayerShip.Inventory.UnlimitedCapacity = true; MySession.PlayerShip.Inventory.MaxItems = MyGamePlayCheatsConstants.CHEAT_INCREASE_CARGO_CAPACITY_MAX_ITEMS; }