From 790e2b455e036f5016f2edd2483b0ed55d90b9a6 Mon Sep 17 00:00:00 2001 From: bmgjet <50484759+bmgjet@users.noreply.github.com> Date: Fri, 21 Jun 2024 14:49:08 +1200 Subject: [PATCH] Add files via upload --- PersonalVaultDoor.cs | 62 ++++++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 23 deletions(-) diff --git a/PersonalVaultDoor.cs b/PersonalVaultDoor.cs index 0645b1d..3294ed9 100644 --- a/PersonalVaultDoor.cs +++ b/PersonalVaultDoor.cs @@ -1,3 +1,12 @@ +/*▄▄▄ ███▄ ▄███▓ ▄████ ▄▄▄██▀▀▀▓█████▄▄▄█████▓ +▓█████▄ ▓██▒▀█▀ ██▒ ██▒ ▀█▒ ▒██ ▓█ ▀▓ ██▒ ▓▒ +▒██▒ ▄██▓██ ▓██░▒██░▄▄▄░ ░██ ▒███ ▒ ▓██░ ▒░ +▒██░█▀ ▒██ ▒██ ░▓█ ██▓▓██▄██▓ ▒▓█ ▄░ ▓██▓ ░ +░▓█ ▀█▓▒██▒ ░██▒░▒▓███▀▒ ▓███▒ ░▒████▒ ▒██▒ ░ +░▒▓███▀▒░ ▒░ ░ ░ ░▒ ▒ ▒▓▒▒░ ░░ ▒░ ░ ▒ ░░ +▒░▒ ░ ░ ░ ░ ░ ░ ▒ ░▒░ ░ ░ ░ ░ + ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ + ░ ░ ░ ░ ░ ░ ░*/ using Oxide.Game.Rust.Cui; using ProtoBuf; using Newtonsoft.Json; @@ -22,19 +31,19 @@ namespace Oxide.Plugins { [JsonProperty("Vault Max Health")] public static float VaultMaxHealth = 2000; - + [JsonProperty(PropertyName = "Vault health name color")] public static string vaulthealthcolor = "#00FF00"; - + [JsonProperty(PropertyName = "Range to show health")] public static float vaultrange = 3f; - + [JsonProperty("Repair Delay")] public float RepairDelay = 60; [JsonProperty("Repair Ammount")] public int RepairAmmount = 25; - + [JsonProperty("Spawn Cost type (serverrewards,economics,resources)")] public string Costtype = "resources"; @@ -52,7 +61,7 @@ namespace Oxide.Plugins [JsonProperty("Charge to craft")] public bool craftcosts = true; - + [JsonProperty("Repair Cost")] //Items and quanity needed to repair public Dictionary RepairCost = new Dictionary @@ -61,7 +70,7 @@ namespace Oxide.Plugins {"metal.fragments", 100}, {"metal.refined", 10}, }; - + [JsonProperty("Craft Cost")] //Items and quanity needed per craft public Dictionary CraftCost = new Dictionary @@ -194,9 +203,8 @@ namespace Oxide.Plugins plugin = null; } - void OnEntityKill(BaseNetworkable entity) + void OnEntityKill(Door entity) { - if (entity == null) return; //Check if vault door if (entity.ShortPrefabName == "door.vault.static") { @@ -223,24 +231,32 @@ namespace Oxide.Plugins } } - //Code and KeyLock position Fix - void OnEntitySpawned(BaseEntity cl) + void OnEntitySpawned(CodeLock cl) { - if (Rust.Application.isLoading) return; - - if (cl == null) { return; } - //Checks if codelock/keylock - if (cl is CodeLock || cl is KeyLock) + BaseEntity Door = cl.GetParentEntity(); + if (Door != null && Door.ToString().Contains("door.vault.static")) { - //Checks if its a vault door - BaseEntity Door = cl.GetParentEntity(); - if (Door != null && Door.ToString().Contains("door.vault.static")) - { - //Moves codelock and update - cl.transform.localPosition += codeoffset; - cl.SendNetworkUpdateImmediate(true); - } + //Moves codelock and update + cl.transform.localPosition += codeoffset; + cl.SendNetworkUpdateImmediate(true); } + } + + void OnEntitySpawned(KeyLock cl) + { + BaseEntity Door = cl.GetParentEntity(); + if (Door != null && Door.ToString().Contains("door.vault.static")) + { + //Moves codelock and update + cl.transform.localPosition += codeoffset; + cl.SendNetworkUpdateImmediate(true); + } + } + + //Code and KeyLock position Fix + void OnEntitySpawned(Door cl) + { + if (Rust.Application.isLoading) { return; } //Add component in spawn here so Copypaste can Work with vaultdoors. if (cl is Door && cl.ToString().Contains("door.vault.static")) {