Changes by code002lover
This commit is contained in:
parent
14e32bc921
commit
a8063216cc
@ -1,51 +1,10 @@
|
|||||||
using CustomPlayerEffects;
|
|
||||||
using LabApi.Features.Wrappers;
|
using LabApi.Features.Wrappers;
|
||||||
using Mirror;
|
|
||||||
using PlayerRoles.FirstPersonControl;
|
using PlayerRoles.FirstPersonControl;
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.SceneManagement;
|
|
||||||
using Logger = LabApi.Features.Console.Logger;
|
using Logger = LabApi.Features.Console.Logger;
|
||||||
using Random = System.Random;
|
using Random = System.Random;
|
||||||
|
|
||||||
namespace CustomClasses;
|
namespace CustomClasses;
|
||||||
|
|
||||||
public abstract class CustomPlayerEffect : StatusEffectBase
|
|
||||||
{
|
|
||||||
private static bool _isLoaded;
|
|
||||||
|
|
||||||
public Player Owner { get; private set; } = null!;
|
|
||||||
|
|
||||||
protected override void Start()
|
|
||||||
{
|
|
||||||
Owner = Player.Get(Hub);
|
|
||||||
base.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString() => $"{GetType().Name}: Owner ({Owner}) - Intensity ({Intensity}) - Duration {Duration}";
|
|
||||||
|
|
||||||
internal static void Initialize()
|
|
||||||
{
|
|
||||||
SceneManager.sceneLoaded += (_, _) =>
|
|
||||||
{
|
|
||||||
if (_isLoaded)
|
|
||||||
return;
|
|
||||||
|
|
||||||
_isLoaded = true;
|
|
||||||
|
|
||||||
var playerEffects = NetworkManager.singleton.playerPrefab.GetComponent<ReferenceHub>().playerEffectsController.effectsGameObject.transform;
|
|
||||||
var type = typeof(DisableStaminaRegenEffect);
|
|
||||||
if (!typeof(StatusEffectBase).IsAssignableFrom(type))
|
|
||||||
{
|
|
||||||
Logger.Error($"[CustomPlayerEffect.Initialize] {type.FullName} is not a valid StatusEffectBase and thus could not be registered!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// register effect into prefab
|
|
||||||
new GameObject(type.Name, type).transform.parent = playerEffects;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class DisableStaminaRegenEffect : CustomPlayerEffect, IStaminaModifier
|
public class DisableStaminaRegenEffect : CustomPlayerEffect, IStaminaModifier
|
||||||
{
|
{
|
||||||
public bool StaminaModifierActive => IsEnabled;
|
public bool StaminaModifierActive => IsEnabled;
|
||||||
|
@ -113,9 +113,11 @@ public sealed class CustomClasses : Plugin
|
|||||||
// Then decode using standard base64
|
// Then decode using standard base64
|
||||||
var decodedBytes = Convert.FromBase64String(standardized);
|
var decodedBytes = Convert.FromBase64String(standardized);
|
||||||
var decodedMessage = System.Text.Encoding.UTF8.GetString(decodedBytes);
|
var decodedMessage = System.Text.Encoding.UTF8.GetString(decodedBytes);
|
||||||
|
|
||||||
Logger.Info(decodedMessage);
|
Logger.Info(decodedMessage);
|
||||||
|
|
||||||
|
CustomPlayerEffect.Initialize();
|
||||||
|
|
||||||
PlayerEvents.Spawned += OnPlayerSpawned;
|
PlayerEvents.Spawned += OnPlayerSpawned;
|
||||||
ServerEvents.RoundEnded += OnRoundEnded;
|
ServerEvents.RoundEnded += OnRoundEnded;
|
||||||
Scp914Events.ProcessingPickup += OnScp914ProcessingPickup;
|
Scp914Events.ProcessingPickup += OnScp914ProcessingPickup;
|
||||||
|
45
CustomClasses/CustomPlayerEffect.cs
Normal file
45
CustomClasses/CustomPlayerEffect.cs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
using CustomPlayerEffects;
|
||||||
|
using LabApi.Features.Wrappers;
|
||||||
|
using Mirror;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
using Logger = LabApi.Features.Console.Logger;
|
||||||
|
|
||||||
|
namespace CustomClasses;
|
||||||
|
|
||||||
|
public abstract class CustomPlayerEffect : StatusEffectBase
|
||||||
|
{
|
||||||
|
private static bool _isLoaded;
|
||||||
|
|
||||||
|
public Player Owner { get; private set; } = null!;
|
||||||
|
|
||||||
|
protected override void Start()
|
||||||
|
{
|
||||||
|
Owner = Player.Get(Hub);
|
||||||
|
base.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString() => $"{GetType().Name}: Owner ({Owner}) - Intensity ({Intensity}) - Duration {Duration}";
|
||||||
|
|
||||||
|
internal static void Initialize()
|
||||||
|
{
|
||||||
|
SceneManager.sceneLoaded += (_, _) =>
|
||||||
|
{
|
||||||
|
if (_isLoaded)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_isLoaded = true;
|
||||||
|
|
||||||
|
var playerEffects = NetworkManager.singleton.playerPrefab.GetComponent<ReferenceHub>().playerEffectsController.effectsGameObject.transform;
|
||||||
|
var type = typeof(DisableStaminaRegenEffect);
|
||||||
|
if (!typeof(StatusEffectBase).IsAssignableFrom(type))
|
||||||
|
{
|
||||||
|
Logger.Error($"[CustomPlayerEffect.Initialize] {type.FullName} is not a valid StatusEffectBase and thus could not be registered!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// register effect into prefab
|
||||||
|
new GameObject(type.Name, type).transform.parent = playerEffects;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -67,6 +67,7 @@ public class SetCClassCommand : ICommand
|
|||||||
SerpentsHandManager.PreSpawn(player);
|
SerpentsHandManager.PreSpawn(player);
|
||||||
}),
|
}),
|
||||||
"negromancer" => manager.ForceSpawn(player, customClasses.NegromancerConfig, typeof(NegromancerConfig), null),
|
"negromancer" => manager.ForceSpawn(player, customClasses.NegromancerConfig, typeof(NegromancerConfig), null),
|
||||||
|
"bloodfueled" => manager.ForceSpawn(player, customClasses.BloodFueledConfig, typeof(BloodFueledConfig), null),
|
||||||
_ => false
|
_ => false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user