OnDeepSeaOpened
OnDeepSeaOpened is called after the server finishes its deep sea open routine, once the manager has reset its wipe steps, sent the open notification and registered the spawned planters.
void OnDeepSeaOpened(DeepSeaManager deepSeaManager)Parameters
| Parameter | Type | Description |
|---|---|---|
deepSeaManager | DeepSeaManager | The DeepSeaManager instance whose open routine just finished. It is the server-side manager for the deep sea (underwater monument) event; use it to identify the event, inspect state or trigger follow-up logic. |
Return value
This injection ignores your return value. OnDeepSeaOpened is called as a plain notification, so returning null, true or anything else changes nothing, and the coroutine continues to return false as usual.
How it works
The hook fires at the tail of DeepSeaManager.OpenDeepSeaAsync, the coroutine that turns the deep sea event on. Because it is placed after ResetWipeSteps, DoOpenNotification, PlanterBoxStatic.OnDeepSeaSpawned and the analytics toggle, everything the server does to open the event has already happened when your method runs; the manager is fully opened at this point. The single argument is the DeepSeaManager, useful when you want to react to the open as a whole rather than to individual entities, for example to broadcast a message, start a timer or record the last open time in oxide/data. There is no narrower overload to narrow to here: the parameter is already the concrete manager type, so declare it exactly as DeepSeaManager and confirm it is not null before touching it. The hook is not called per player or per planter, only once per open. Treat it as an event notification, not as a place to run heavy work on the main thread.
Example plugin: Announce deep sea opens and track open count
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Core;
using UnityEngine;
namespace Oxide.Plugins
{
[Info("Deep Sea Open Announcer", "RustPluginGenerator", "1.0.0")]
[Description("Announces deep sea opens and tracks a simple open history.")]
public class DeepSeaOpenAnnouncer : RustPlugin
{
private const string DataFile = "DeepSeaOpenAnnouncer";
private PluginConfig config;
private StoredData data;
private float lastOpenAt = -60f;
private class PluginConfig
{
[JsonProperty("Broadcast message on open")]
public bool BroadcastOnOpen { get; set; } = true;
[JsonProperty("Seconds between announcements")]
public float CooldownSeconds { get; set; } = 60f;
}
private class StoredData
{
[JsonProperty("Open count")]
public int OpenCount { get; set; }
[JsonProperty("Last open UTC")]
public string LastOpenUtc { get; set; } = "";
}
protected override void LoadDefaultConfig() => config = new PluginConfig();
protected override void LoadConfig()
{
base.LoadConfig();
try
{
config = Config.ReadObject<PluginConfig>();
if (config == null) throw new Exception();
}
catch
{
PrintWarning("Configuration file is invalid, using defaults");
LoadDefaultConfig();
}
SaveConfig();
}
protected override void SaveConfig() => Config.WriteObject(config);
protected override void LoadDefaultMessages()
{
lang.RegisterMessages(new Dictionary<string, string>
{
["Broadcast"] = "The deep sea has opened. New loot is available down below.",
["Saved"] = "Deep sea open recorded. Total opens: {0}."
}, this);
}
private string Msg(string key, string userId = null, params object[] args)
=> string.Format(lang.GetMessage(key, this, userId), args);
private void OnServerInitialized()
{
data = Interface.Oxide.DataFileSystem.ReadObject<StoredData>(DataFile) ?? new StoredData();
}
private void OnDeepSeaOpened(DeepSeaManager deepSeaManager)
{
if (deepSeaManager == null) return;
float now = UnityEngine.Time.realtimeSinceStartup;
if (now - lastOpenAt < config.CooldownSeconds) return;
lastOpenAt = now;
data.OpenCount++;
data.LastOpenUtc = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss");
Interface.Oxide.DataFileSystem.WriteObject(DataFile, data);
if (config.BroadcastOnOpen)
{
Server.Broadcast(Msg("Broadcast"));
}
}
private void Unload()
{
if (data != null)
{
Interface.Oxide.DataFileSystem.WriteObject(DataFile, data);
}
}
}
}The plugin listens on OnDeepSeaOpened and increments a counter stored in oxide/data, so admins can see how many times the deep sea event opened. It broadcasts a chat message to every connected player, using text loaded from the language file through LoadDefaultMessages. The counter is read once in OnServerInitialized and written back every time the hook fires, with the saved file flushed in Unload. A short cooldown check prevents duplicate broadcasts if the open routine runs more than once in a minute. All work is lightweight, so it stays safe on the main thread.
Common use cases
Announce the event to players
Broadcast a chat or HUD message when the deep sea opens so players know new loot is available. Use
Server.Broadcastor a CUI overlay if you want something more visible.Record open history
Save a timestamp in
Interface.Oxide.DataFileSystemso admins can see when the deep sea last opened and how often the event triggers on the server.Start a follow-up timer
Schedule a delayed message or a reset notification after the open, for example a warning that a related resource spawn closes in ten minutes. Keep the
Timerreference soUnloadcan cancel it.
Pitfalls
Not called per player or per entity
The hook fires once for the whole open, not for every planter or player nearby. Do not place per-player logic inside it assuming it runs for each participant.
No overload narrowing
There is only one parameter type,
DeepSeaManager. Do not substituteBaseEntityorComponentexpectations; declareDeepSeaManagerexactly so the dispatch matches.Return value is ignored
Returning anything from the hook does not cancel the open. The
OpenDeepSeaAsynccoroutine still returns false after the hook call, and the event stays open.
Build a plugin with OnDeepSeaOpened
Describe what should happen and get a compiled plugin that uses this hook.
Edit the prompt on the next screen. 2 free plugins a month, no card.
Last updated Oct 26, 2026. Found a mistake? Email support@rustplugingenerator.com.
Build a plugin with OnDeepSeaOpened
Generate