About Monuments Watcher
A plugin creating a trigger box around Monuments and CargoShips to track entry and exit of players, npcs and entities from it.
The list of all monuments can be viewed in the:
- Vanilla - *SERVER*\oxide\data\MonumentsWatcher\MonumentsBounds.json
- Custom - *SERVER*\oxide\data\MonumentsWatcher\CustomMonumentsBounds.json
Note: MonumentsWatcher is utilized as an API for other plugins. You won't obtain any functionality beyond displaying monument boundaries without an additional plugin.
- The ability to automatically generate boundaries for vanilla and custom monuments;
- The ability to automatically regenerate boundaries for monuments on wipe;
- The ability to automatically adding languages for custom monuments;
- The ability to manually configure boundaries for monuments;
- The ability to track the entrance and exit of players, npcs and entities in a Monument and CargoShip;
- The ability to display boundaries.
- monumentswatcher.admin - Provides the capability to recreate or display monument boundaries.
{
"Chat command": "monument",
"Use GameTip for messages?": true,
"Is it worth recreating boundaries(excluding custom monuments) upon detecting a wipe?": true,
"List of tracked types of monuments. Leave blank to track all": [],
"Wipe ID": null,
"Version": {
"Major": 0,
"Minor": 1,
"Patch": 6
}
}
Monument bounds example:
"airfield_1": {
"Center": {
"x": 335.881531,
"y": 9.936,
"z": 2096.53345
},
"CenterOffset": {
"x": 0.0,
"y": 15.0,
"z": -25.0
},
"Size": {
"x": 360.0,
"y": 60.0,
"z": 210.0
},
"Rotation": {
"x": 0.0,
"y": 44.06058,
"z": 0.0
}
},
...
Custom Monument bounds example:
"exit69": {
"MonumentType": 12,
"Center": {
"x": 336.676483,
"y": 47.65218,
"z": -39.02194
},
"CenterOffset": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"Size": {
"x": 100.0,
"y": 100.0,
"z": 100.0
},
"Rotation": {
"x": 0.0,
"y": 0.0,
"z": 0.0
}
},
...
Note: MonumentType can be found in the Developer API section.
ENG: https://pastebin.com/nsjBCqZe
RUS: https://pastebin.com/ut2icv9T
Note: After initialization, the names of custom monuments will also be added here.
- rotation - Sets the monument rotation based on the argument or the player's view direction;
- recreate - Recreating boundaries for all monuments;
- show - Displays the boundaries of the monument in which the player is located, either by specified ID or key.
Example:
-
Rotation:
- /monument rotation - Rotation of the monument towards the player's head direction, in which the player is located
- /monument rotation gas_station_1_0 256.5 - Monument rotation with specified arguments: monument ID and Y coordinate
-
Display by monument key(Will display all monuments with such a key):
- /monument show gas_station_1
-
Display by monument ID(Will display one monument with the specified ID):
- /monument show gas_station_1_4
-
void OnMonumentsWatcherLoaded()
- Called when the MonumentsWatcher plugin has fully loaded.
-
void OnCargoWatcherCreated(string monumentID, string type)
- Called when a watcher is created for a CargoShip.
-
void OnCargoWatcherDeleted(string monumentID)
-
Called when a watcher is removed for a CargoShip.
-
Called when a watcher is removed for a CargoShip.
void OnMonumentsWatcherLoaded() { Puts("MonumentsWatcher plugin is ready!"); } void OnCargoWatcherCreated(string monumentID, string type) { Puts($"Watcher for monument {monumentID}({type}) has been created!"); } void OnCargoWatcherDeleted(string monumentID) { Puts($"Watcher for monument {monumentID} has been deleted!"); }
-
Entered hooks:
-
void OnPlayerEnteredMonument(string monumentID, BasePlayer player, string type, string oldMonumentID)
- Called when a player enters any monument
-
void OnNpcEnteredMonument(string monumentID, BasePlayer npcPlayer, string type, string oldMonumentID)
- Called when an NPC player enters any monument
-
void OnEntityEnteredMonument(string monumentID, BaseEntity entity, string type, string oldMonumentID)
-
Called when any other BaseEntity enters any monument
-
Called when any other BaseEntity enters any monument
-
void OnPlayerEnteredMonument(string monumentID, BasePlayer player, string type, string oldMonumentID)
void OnPlayerEnteredMonument(string monumentID, BasePlayer player, string type, string oldMonumentID) { Puts($"{player.displayName} entered to {monumentID}({type}). His previous monument was {oldMonumentID}"); } void OnNpcEnteredMonument(string monumentID, BasePlayer npcPlayer, string type, string oldMonumentID) { Puts($"Npc({npcPlayer.displayName}) entered to {monumentID}({type}). Previous monument was {oldMonumentID}"); } void OnEntityEnteredMonument(string monumentID, BaseEntity entity, string type, string oldMonumentID) { Puts($"Entity({entity.net.ID}) entered to {monumentID}({type}). Previous monument was {oldMonumentID}"); }
-
Exited hooks:
-
void OnPlayerExitedMonument(string monumentID, BasePlayer player, string type, string reason, string newMonumentID)
- Called when a player exits any monument
-
void OnNpcExitedMonument(string monumentID, BasePlayer npcPlayer, string type, string reason, string newMonumentID)
- Called when an NPC player exits any monument
-
void OnEntityExitedMonument(string monumentID, BaseEntity entity, string type, string reason, string newMonumentID)
-
Called when any other BaseEntity exits any monument
-
Called when any other BaseEntity exits any monument
-
void OnPlayerExitedMonument(string monumentID, BasePlayer player, string type, string reason, string newMonumentID)
void OnPlayerExitedMonument(string monumentID, BasePlayer player, string type, string reason, string newMonumentID) { Puts($"{player.displayName} left from {monumentID}({type}). Reason: {reason}. They are now at '{newMonumentID}'."); } void OnNpcExitedMonument(string monumentID, BasePlayer npcPlayer, string type, string reason, string newMonumentID) { Puts($"Npc({npcPlayer.displayName}) left from {monumentID}({type}). Reason: {reason}. They are now in {newMonumentID}"); } void OnEntityExitedMonument(string monumentID, BaseEntity entity, string type, string reason, string newMonumentID) { Puts($"Entity({entity.net.ID}) left from {monumentID}({type}). Reason: {reason}. They are now in {newMonumentID}"); }
[PluginReference] private Plugin MonumentsWatcher;
There are 13 types of monuments:
-
SafeZone(0):
- Bandit Camp, Outpost, Fishing Village, Ranch and Large Barn.
-
RadTown(1):
- Airfield, Arctic Research Base, Abandoned Military Base, Giant Excavator Pit, Ferry Terminal, Harbor, Junkyard, Launch Site;
- Military Tunnel, Missile Silo, Power Plant, Sewer Branch, Satellite Dish, The Dome, Train Yard, Water Treatment Plant.
-
RadTownWater(2):
- Oil Rig, Underwater Lab and CargoShip.
-
RadTownSmall(3):
- Lighthouse, Oxum's Gas Station, Abandoned Supermarket and Mining Outpost.
- TunnelStation(4)
-
MiningQuarry(5):
- Sulfur Quarry, Stone Quarry and HQM Quarry.
- BunkerEntrance(6)
- Cave(7)
- Swamp(8)
- IceLake(9)
- PowerSubstation(10)
- WaterWell(11)
- Custom(12)
There are 22 api methods:
GetMonumentDisplayName:
Used to retrieve the nice name of the monument, considering the player's language. Returns an empty string on failure.
To call the GetMonumentDisplayName method, you need to pass 3 parameters:
- monumentID as a string;
- userID as either a string or a ulong. You can provide 0 or empty string to get default(eng) language;
-
displaySuffix() as a bool. Should the suffix be displayed in the name if there are multiple such monuments? This parameter is optional.
(string)MonumentsWatcher?.Call("GetMonumentDisplayName", monumentID, player.userID, true); (string)MonumentsWatcher?.Call("GetMonumentDisplayName", monumentID, player.UserIDString, true);
GetMonumentType:
Used to retrieve the monument type. Returns an empty string on failure.
To call the GetMonumentType method, you need to pass 1 parameter:
-
monumentID as a string.
(string)MonumentsWatcher?.Call("GetMonumentType", monumentID);
GetMonumentPosition:
Used to retrieve the position of the monument. Returns Vector3.zero on failure.
To call the GetMonumentPosition method, you need to pass 1 parameter:
-
monumentID as a string.
(Vector3)MonumentsWatcher?.Call("GetMonumentPosition", monumentID);
GetMonumentsList:
Used to retrieve an array of monumentIDs for all available monuments.
(string[])MonumentsWatcher?.Call("GetMonumentsList");
GetMonumentsTypeDictionary:
Used to retrieve a dictionary of all available monuments with their types.
(Dictionary<string, string>)MonumentsWatcher?.Call("GetMonumentsTypeDictionary");
GetMonumentsByType:
Used to retrieve an array of all available monuments by type.
To call the GetMonumentsByType method, you need to pass 1 parameter:
-
monument type as a string.
(string[])MonumentsWatcher?.Call("GetMonumentsByType", "SafeZone");
GetMonumentPlayers:
Used to retrieve a list of players in the monument. Returns null on failure.
To call the GetMonumentPlayers method, you need to pass 1 parameter:
-
monumentID as a string.
(HashSet<BasePlayer>)MonumentsWatcher?.Call("GetMonumentPlayers", monumentID);
GetMonumentNpcs:
Used to retrieve a list of npc players in the monument. Returns null on failure.
To call the GetMonumentNpcs method, you need to pass 1 parameter:
-
monumentID as a string.
(HashSet<BasePlayer>)MonumentsWatcher?.Call("GetMonumentNpcs", monumentID);
GetMonumentEntities:
Used to retrieve a list of entities in the monument. Returns null on failure.
To call the GetMonumentEntities method, you need to pass 1 parameter:
-
monumentID as a string.
(HashSet<BaseEntity>)MonumentsWatcher?.Call("GetMonumentEntities", monumentID);
GetPlayerMonument:
Used to retrieve the monumentID of the monument in which the player is located. Returns an empty string on failure.
To call the GetPlayerMonument method, you need to pass 1 parameter:
-
player as BasePlayer or userID as a ulong.
(string)MonumentsWatcher?.Call("GetPlayerMonument", player); (string)MonumentsWatcher?.Call("GetPlayerMonument", player.userID);
GetNpcMonument:
Used to retrieve the monumentID of the monument in which the npc player is located. Returns an empty string on failure.
To call the GetNpcMonument method, you need to pass 1 parameter:
-
npcPlayer as BasePlayer or NetworkableId.
(string)MonumentsWatcher?.Call("GetNpcMonument", npcPlayer); (string)MonumentsWatcher?.Call("GetNpcMonument", npcPlayer.net.ID);
GetEntityMonument:
Used to retrieve the monumentID of the monument in which the entity is located. Returns an empty string on failure.
To call the GetEntityMonument method, you need to pass 1 parameter:
-
entity as a BaseEntity or NetworkableId.
(string)MonumentsWatcher?.Call("GetEntityMonument", entity); (string)MonumentsWatcher?.Call("GetEntityMonument", entity.net.ID);
GetPlayerMonuments:
Used to retrieve an array of monumentIDs for the monuments in which the player is located. Returns null on failure.
To call the GetPlayerMonuments method, you need to pass 1 parameter:
-
player as BasePlayer or userID as a ulong.
(string[])MonumentsWatcher?.Call("GetPlayerMonuments", player); (string[])MonumentsWatcher?.Call("GetPlayerMonuments", player.userID);
GetNpcMonuments:
Used to retrieve an array of monumentIDs for the monuments in which the npc player is located. Returns an null on failure.
To call the GetNpcMonuments method, you need to pass 1 parameter:
-
npcPlayer as BasePlayer or NetworkableId.
(string[])MonumentsWatcher?.Call("GetNpcMonuments", npcPlayer); (string[])MonumentsWatcher?.Call("GetNpcMonuments", npcPlayer.net.ID);
GetEntityMonuments:
Used to retrieve an array of monumentID for the monuments in which the entity is located. Returns an null on failure.
To call the GetEntityMonuments method, you need to pass 1 parameter:
-
entity as a BaseEntity or NetworkableId.
(string[])MonumentsWatcher?.Call("GetEntityMonuments", entity); (string[])MonumentsWatcher?.Call("GetEntityMonuments", entity.net.ID);
GetMonumentByPos:
Used to obtain the monumentID based on coordinates. Returns an empty string on failure.
To call the GetMonumentByPos method, you need to pass 1 parameter:
-
position as a Vector3.
(string)MonumentsWatcher?.Call("GetMonumentByPos", pos);
Note: This method returns the first encountered monument. Occasionally, there may be multiple monuments at a single point. Therefore, it is recommended to use the GetMonumentsByPos method.
GetMonumentsByPos:
Used to obtain a string array of monumentIDs based on coordinates. Returns null on failure.
To call the GetMonumentsByPos method, you need to pass 1 parameter:
-
position as a Vector3.
(string[])MonumentsWatcher?.Call("GetMonumentsByPos", pos);
IsPosInMonument:
Used to check if the specified position is within the monument. Returns a false on failure.
To call the IsPosInMonument method, you need to pass 2 parameters:
- monumentID as a string;
-
position as a Vector3.
(bool)MonumentsWatcher?.Call("IsPosInMonument", monumentID, pos);
IsPlayerInMonument:
Used to check if the player is in the monument. Returns a false on failure.
To call the IsPlayerInMonument method, you need to pass 2 parameters:
- monumentID as a string;
-
player as a BasePlayer or userID as a ulong.
(bool)MonumentsWatcher?.Call("IsPlayerInMonument", monumentID, player); (bool)MonumentsWatcher?.Call("IsPlayerInMonument", monumentID, player.userID);
IsNpcInMonument:
Used to check if the npc player is in the monument. Returns a false on failure.
To call the IsNpcInMonument method, you need to pass 2 parameters:
- monumentID as a string;
-
npcPlayer as a BasePlayer or NetworkableId.
(bool)MonumentsWatcher?.Call("IsNpcInMonument", monumentID, npcPlayer); (bool)MonumentsWatcher?.Call("IsNpcInMonument", monumentID, npcPlayer.net.ID);
IsEntityInMonument:
Used to check if the entity is in the monument. Returns a false on failure.
To call the IsEntityInMonument method, you need to pass 2 parameters:
- monumentID as a string;
-
entity as a BaseEntity or NetworkableId.
(bool)MonumentsWatcher?.Call("IsEntityInMonument", monumentID, entity); (bool)MonumentsWatcher?.Call("IsEntityInMonument", monumentID, entity.net.ID);
ShowBounds:
Used to display the monument boundaries to the player.
Note: Since an Admin flag is required for rendering, players without it will be temporarily granted an Admin flag and promptly revoked.
To call the ShowBounds method, you need to pass 3 parameters:
- monumentID as a string;
- player as a BasePlayer;
-
displayDuration as a float. Duration of displaying the monument boundaries in seconds. This parameter is optional.
MonumentsWatcher?.Call("ShowBounds", monumentID, player, 20f);