Slight fixes
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
using System.Diagnostics;
|
||||
using System.Numerics;
|
||||
using CustomPlayerEffects;
|
||||
using InventorySystem.Items;
|
||||
using LabApi.Events.Arguments.PlayerEvents;
|
||||
using LabApi.Features.Wrappers;
|
||||
using MapGeneration;
|
||||
@@ -7,6 +10,7 @@ using PlayerRoles;
|
||||
using Respawning.Waves;
|
||||
using Utils;
|
||||
using Logger = LabApi.Features.Console.Logger;
|
||||
using MicroHIDItem = InventorySystem.Items.MicroHID.MicroHIDItem;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace GamblingCoin
|
||||
@@ -60,14 +64,54 @@ namespace GamblingCoin
|
||||
.AddAction(x =>
|
||||
{
|
||||
x.Player.SendBroadcast(configMessages.LegendaryItemSpawnMessage, configGameplay.BroadcastDuration);
|
||||
SpawnRandomItemAtPlayer(x.Player, configGameplay.Items.LegendaryItems);
|
||||
|
||||
var player = x.Player;
|
||||
var items = configGameplay.Items.LegendaryItems;
|
||||
|
||||
var itemIndex = Random.Range(0, items.Length);
|
||||
var item = items[itemIndex];
|
||||
|
||||
var pickup = Pickup.Create(item, player.Position + new UnityEngine.Vector3(0,1,0));
|
||||
if (pickup == null) return;
|
||||
|
||||
if (item is ItemType.MicroHID)
|
||||
{
|
||||
var host = Player.List.First(player1 => player1.IsHost);
|
||||
var micro = host.AddItem(pickup)!.Base;
|
||||
|
||||
var microItem = (MicroHIDItem)micro;
|
||||
microItem.EnergyManager.ServerSetEnergy(microItem.ItemId.SerialNumber, 100);
|
||||
|
||||
var newPickup = host.DropItem(micro);
|
||||
newPickup.Position = player.Position + new UnityEngine.Vector3(0, 1, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
pickup.Spawn();
|
||||
}, configChances.LegendaryItemChance)
|
||||
.AddAction(x =>
|
||||
{
|
||||
x.Player.SendBroadcast(configMessages.RandomTeleportMessage, configGameplay.BroadcastDuration);
|
||||
|
||||
var randomRoom = Map.GetRandomRoom();
|
||||
if (randomRoom == null) return;
|
||||
if(randomRoom == null) return;
|
||||
|
||||
var isInOtherZone = randomRoom is { Zone: FacilityZone.Other };
|
||||
var isDetonated = Warhead.IsDetonated;
|
||||
var isDecontaminating = Decontamination.IsDecontaminating;
|
||||
|
||||
var isInDetonatedZone = isDetonated && randomRoom.Zone is FacilityZone.HeavyContainment
|
||||
or FacilityZone.LightContainment or FacilityZone.Entrance;
|
||||
var isInDecontaminatedZone = isDecontaminating && randomRoom.Zone is FacilityZone.LightContainment;
|
||||
while (isInOtherZone || isInDetonatedZone || isInDecontaminatedZone)
|
||||
{
|
||||
randomRoom = Map.GetRandomRoom();
|
||||
if(randomRoom == null) return;
|
||||
|
||||
isInOtherZone = randomRoom is { Zone: FacilityZone.Other };
|
||||
isInDetonatedZone = isDetonated && randomRoom.Zone is FacilityZone.HeavyContainment
|
||||
or FacilityZone.LightContainment or FacilityZone.Entrance;
|
||||
isInDecontaminatedZone = isDecontaminating && randomRoom.Zone is FacilityZone.LightContainment;
|
||||
}
|
||||
|
||||
var newPos = randomRoom.Position;
|
||||
|
||||
@@ -85,7 +129,7 @@ namespace GamblingCoin
|
||||
|
||||
x.Player.ClearInventory();
|
||||
|
||||
ExplosionUtils.ServerExplode(x.Player.ReferenceHub, ExplosionType.Custom);
|
||||
TimedGrenadeProjectile.SpawnActive(x.Player.Position, ItemType.GrenadeHE, x.Player);
|
||||
}, configChances.ExplosionChance)
|
||||
.AddAction(x =>
|
||||
{
|
||||
@@ -97,9 +141,7 @@ namespace GamblingCoin
|
||||
{
|
||||
x.Player.SendBroadcast(configMessages.GrenadeMessage, configGameplay.BroadcastDuration);
|
||||
|
||||
var grenade = (TimedGrenadeProjectile)Pickup.Create(ItemType.GrenadeHE, x.Player.Position);
|
||||
grenade?.Spawn();
|
||||
grenade?.FuseEnd();
|
||||
TimedGrenadeProjectile.SpawnActive(x.Player.Position, ItemType.GrenadeHE, x.Player, 2);
|
||||
}, configChances.GrenadeChance)
|
||||
.AddAction(x =>
|
||||
{
|
||||
@@ -107,6 +149,8 @@ namespace GamblingCoin
|
||||
|
||||
var newPos = Map.Rooms.First(roomIdentifier => roomIdentifier.Zone==FacilityZone.Other).Position;
|
||||
|
||||
x.Player.ReferenceHub.playerEffectsController.ChangeState(nameof(Corroding),1, 999, true);
|
||||
|
||||
x.Player.Position = newPos + new UnityEngine.Vector3(0, configGameplay.TeleportHeightOffset, 0);
|
||||
},
|
||||
configChances.PocketDimensionChance)
|
||||
@@ -156,7 +200,11 @@ namespace GamblingCoin
|
||||
{
|
||||
x.Player.AddItem(randomPlayerItem.Type);
|
||||
}
|
||||
}, configChances.SwitchInventoryChance);
|
||||
}, configChances.SwitchInventoryChance)
|
||||
.AddAction(x =>
|
||||
{
|
||||
x.Player.CurrentItem?.DropItem().Destroy();
|
||||
}, configChances.RemoveCoinChance);
|
||||
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user