47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
using Oxide.Core.Plugins;
|
|
using UnityEngine;
|
|
|
|
namespace Oxide.Plugins {
|
|
|
|
[Info("ZombieHorde", "TungstonMiner", "0.1.0")]
|
|
[Description("Create a zombie horde at midnight every seventh day")]
|
|
public class ZombieHorde : RustPlugin {
|
|
|
|
private bool isHordeActive = false;
|
|
|
|
void OnServerInitialized() {
|
|
Puts("ZombieHorde loaded!");
|
|
timer.Every(10f, () => this.CheckTime());
|
|
}
|
|
|
|
void CheckTime() {
|
|
var sky = TOD_Sky.Instance;
|
|
var day = sky.Cycle.Day;
|
|
var hour = sky.Cycle.Hour;
|
|
var isNight = sky.IsNight;
|
|
|
|
if ((!this.isHordeActive) && (hour < 0.5) && (day % 7 == 0)) {
|
|
this.StartHorde();
|
|
this.isHordeActive = true;
|
|
}
|
|
|
|
if (this.isHordeActive && !isNight) {
|
|
this.EndHorde();
|
|
this.isHordeActive = false;
|
|
}
|
|
}
|
|
|
|
void StartHorde() {
|
|
Puts($"Starting horde at {TOD_Sky.Instance.Cycle.Hour}");
|
|
Server.Command("halloween.murdererpopulation 10");
|
|
Server.Command("spawn.fill_populations");
|
|
}
|
|
|
|
void EndHorde() {
|
|
Puts($"Ending horde at {TOD_Sky.Instance.Cycle.Hour}");
|
|
Server.Command("halloween.murdererpopulation 0");
|
|
Server.Command("spawn.delete_populations Murderer.Population");
|
|
}
|
|
}
|
|
}
|