using System.Collections.Generic; using UnityEngine; using System.Linq; namespace Oxide.Plugins { [Info("SharksWithFrickinLaserBeams", "Steenamaroo", "1.0.0", ResourceId = 0)] [Description("Basic plugin writing template.")] class SharksWithFrickinLaserBeams : RustPlugin { void OnServerInitialized() { foreach (var shark in UnityEngine.Object.FindObjectsOfType()) AddLaser(shark); } void OnEntitySpawned(SimpleShark shark) => AddLaser(shark); List detectors = new List(); void AddLaser(SimpleShark shark) { LaserDetector laser = (LaserDetector)GameManager.server.CreateEntity("assets/prefabs/deployable/playerioents/detectors/laserdetector/laserdetector.prefab", Vector3.zero, Quaternion.Euler(0, 0, 0)); laser.Spawn(); laser.SetParent(shark, false, true); detectors.Add(laser); laser.UpdateHasPower(1000, 0); } void Unload() { foreach (var entry in detectors.ToList()) entry?.Kill(); } } }