Jump to content

console

Closed 4.2.7 4.2.8

Peter Friesenbichler

Posted

(03:06:31) | [UpdateChecker] 17 Nov 2024 03:07

[uMod] LaptopCrateHack 1.1.7 -> 2.0.2 <https://umod.org/plugins/laptop-crate-hack>

[uMod] EventManager 2.2.12 -> 4.0.7 <https://umod.org/plugins/event-manager>

[uMod] Boombox 1.0.1 -> 1.0.2 <https://umod.org/plugins/drone-boombox>

[NotFound] NpcMovingControl, EventManagerNotifier, SatDishEvent, DisablePingEstimation, MapSkinner, PrisonAlert, ColorCode{publicstringhexValue;publicUnityEngine.ColorrustValue;publicstringrustString;publicColorCode(stringhex){hexValue=hex.ToUpper();if(hex.StartsWith("#")){hex=hex.Substring(1);}if(!hexValue.StartsWith("#")){hexValue="#"+hexValue;}//extracttheR,G,Bfloatr=255F,g=0,b=0;try{r=(float)short.Parse(hex.Substring(0,2),System.Globalization.NumberStyles.HexNumber)/255;g=(float)short.Parse(hex.Substring(2,2),System.Globalization.NumberStyles.HexNumber)/255;b=(float)short.Parse(hex.Substring(4,2),System.Globalization.NumberStyles.HexNumber)/255;}catch{Instance.PrintError($"ERROR

dustyhansen

Posted

Do you have Cargo Train Event? It looks like there is a messed up entry in my config file for this plugin:

    {
      "Name": "ColorCode{publicstringhexValue;publicUnityEngine.ColorrustValue;publicstringrustString;publicColorCode(stringhex){hexValue=hex.ToUpper();if(hex.StartsWith(\"#\")){hex=hex.Substring(1);}if(!hexValue.StartsWith(\"#\")){hexValue=\"#\"+hexValue;}//extracttheR,G,Bfloatr=255F,g=0,b=0;try{r=(float)short.Parse(hex.Substring(0,2),System.Globalization.NumberStyles.HexNumber)/255;g=(float)short.Parse(hex.Substring(2,2),System.Globalization.NumberStyles.HexNumber)/255;b=(float)short.Parse(hex.Substring(4,2),System.Globalization.NumberStyles.HexNumber)/255;}catch{Instance.PrintError($\"ERROR",
      "Author": "Nikedemos\", VERSION)]     [Description(\"Just like Cargo Ships - but with trains\")]     public class CargoTrainEvent : RustPlugin     {         private static CargoTrainEvent Instance;         private static Timer EventTimer;          [PluginReference]         private Plugin Kits, FuelManager, TruePVE, DeathNotes, GUIAnnouncements;          #region CONST & STATIC         public const string VERSION = \"1.0.18\";         public const ulong INTERNAL_SKIN = 2847372289;          public const string PREFAB_DRIVER = \"assets/rust.ai/agents/npcplayer/humannpc/scientist/scientistnpc_cargo_turret_any.prefab\";         public const string PREFAB_SCIENTIST = \"assets/rust.ai/agents/npcplayer/humannpc/scientist/scientistnpc_cargo_turret_any.prefab\";          public const string PREFAB_WORKCART = \"assets/content/vehicles/workcart/workcart.entity.prefab\";         public const string PREFAB_LOCOMOTIVE = \"assets/content/vehicles/trains/locomotive/locomotive.entity.prefab\";         public const string PREFAB_SEDAN_TRAIN = \"assets/content/vehicles/sedan_a/sedanrail.entity.prefab\";         public const string PREFAB_ABOVEGROUND_TRAIN = \"assets/content/vehicles/workcart/workcart_aboveground.entity.prefab\";         public const string PREFAB_ABOVEGROUND_TRAIN_2 = \"assets/content/vehicles/workcart/workcart_aboveground2.entity.prefab\";          public const string PREFAB_CRATE_LOCKED = \"assets/prefabs/deployable/chinooklockedcrate/codelockedhackablecrate.prefab\";         public const string PREFAB_CRATE_ELITE = \"assets/bundled/prefabs/radtown/crate_elite.prefab\";         public const string PREFAB_CRATE_BRADLEY = \"assets/prefabs/npc/m2bradley/bradley_crate.prefab\";         public const string PREFAB_CRATE_HELI = \"assets/prefabs/npc/patrol helicopter/heli_crate.prefab\";         public const string PREFAB_CRATE_MARKER = \"assets/prefabs/tools/map/cratemarker.prefab\";         public const string PREFAB_GENERIC_MARKER = \"assets/prefabs/tools/map/genericradiusmarker.prefab\";         public const string PREFAB_RUG = \"assets/prefabs/deployable/rug/rug.deployed.prefab\";         public const string PREFAB_SIRENLIGHT = \"assets/prefabs/deployable/playerioents/lights/sirenlight/electric.sirenlight.deployed.prefab\";         public const string PREFAB_COUNTER = \"assets/prefabs/deployable/playerioents/counter/counter.prefab\";         public const string PREFAB_ALARM = \"assets/prefabs/deployable/playerioents/alarms/audioalarm.prefab\";         public const string PREFAB_CCTV = \"assets/prefabs/deployable/cctvcamera/cctv_deployed.prefab\";          public const string FX_C4_EXPLOSION = \"assets/prefabs/tools/c4/effects/c4_explosion.prefab\";         public const string FX_EXPLOSION_01 = \"assets/bundled/prefabs/fx/explosions/explosion_01.prefab\";         public const string FX_EXPLOSION_02 = \"assets/bundled/prefabs/fx/explosions/explosion_02.prefab\";         public const string FX_EXPLOSION_03 = \"assets/bundled/prefabs/fx/explosions/explosion_03.prefab\";          public const ulong SKIN_SPLAT1 = 2451067899;          public const int ITEM_SNOWBALL = -363689972;         public const int ITEM_SUIT_HEAVY = -1772746857;         public const int ITEM_LOWGRADE = -946369541;          #endregion          #region HOOKS         private void Init()         {             Instance = null;         }          private void OnServerInitialized()         {             Instance = this;             lang.RegisterMessages(LangMessages, this);              permission.RegisterPermission(PERM_ADMIN, this);              LoadConfigData();             ProcessConfigData();              ConfigValues = new Dictionary<string, InteractiveConfigValue>();              GenerateAllInteractiveConfigValues();              SpecialTrain.TrainDriverNetIDToSpecialTrain = new Dictionary<ulong, SpecialTrain>();              SpecialTrain.TrainNetIDToSpecialTrain = new Dictionary<ulong, SpecialTrain>();             SpecialTrain.TrainNetIDToTrainEngine = new Dictionary<ulong, TrainEngine>();             SpecialTrain.WorkcartEntityNetIDToSpecialTrain = new Dictionary<ulong, SpecialTrain>();              SpecialTrain.PlatformTriggerToTrain = new Dictionary<TriggerBase, SpecialTrain>();              SpecialTrain.UserIDToSpecialTrains = new Dictionary<ulong, List<SpecialTrain>>();              //pre-cleanup              foreach (var entity in BaseNetworkable.serverEntities.OfType<BaseEntity>().Where(e => e.skinID == INTERNAL_SKIN || e.skinID == SKIN_SPLAT1))             {                 entity.Kill(BaseNetworkable.DestroyMode.None);             }              foreach (var train in BaseNetworkable.serverEntities.OfType<TrainEngine>())             {                 OnEntitySpawned(train);             }              //broken from December 2021 forced wipe             //FuelManagerCheck();             TruePVECheck();             DeathNotesCheck();              ScheduleTrainEventAtRandom();         }           private void OnBookmarkControlStarted(ComputerStation station, BasePlayer player, string text, CCTV_RC cctv)         {             if (cctv == null) return;              if (cctv.skinID != INTERNAL_SKIN) return;              var group = Network.Net.sv.visibility.GetGroup(cctv.transform.position);              player.net.SwitchSecondaryGroup(group);              Interface.CallHook(\"OnBookmarkControlStartedTrainCCTV\", player, text, cctv);         }          private void OnEntitySpawned(TrainEngine train)         {             if (Instance == null) return;              if (train.PrefabName == PREFAB_LOCOMOTIVE)             {                 return;             }              SpecialTrain.TrainNetIDToTrainEngine.Add(train.net.ID.Value, train);              train.SetFlag(TrainEngine.Flag_AltColor, false);             train.SendNetworkUpdateImmediate();         }          private void OnCrateHack(HackableLockedCrate crate)         {             if (Instance == null) return;              if (crate.skinID != INTERNAL_SKIN) return;              if (!SpecialTrain.WorkcartEntityNetIDToSpecialTrain.ContainsKey(crate.net.ID.Value)) return;               SpecialTrain.WorkcartEntityNetIDToSpecialTrain[crate.net.ID.Value].OnCrateHack(crate);              Interface.CallHook(\"OnTrainCrateHack\", SpecialTrain.WorkcartEntityNetIDToSpecialTrain[crate.net.ID.Value].Train, crate);          }          object OnCounterModeToggle(PowerCounter counter, BasePlayer player, bool wants)         {             if (Instance == null) return null;              if (counter.skinID != INTERNAL_SKIN) return null;              return false;         }          private object CanBeWounded(BasePlayer player)         {             if (Instance == null) return null;             if (!SpecialTrain.TrainDriverNetIDToSpecialTrain.ContainsKey(player.net.ID.Value))             {                 return null;             }              //drivers can't be wounded             return false;         }         private object OnTurretTarget(AutoTurret turret, ScientistNPC target)         {             if (Instance == null) return null;             if (turret == null) return null;             if (turret.net == null) return null;             if (target == null) return null;             if (target.net == null) return null;              if (SpecialTrain.WorkcartEntityNetIDToSpecialTrain.ContainsKey(target.net.ID.Value))             {                 return false;             }              return null;         }          private object CanBradleyApcTarget(BradleyAPC bradley, ScientistNPC target)         {             if (Instance == null) return null;             if (bradley == null) return null;             if (target == null) return null;             if (target.net == null) return null;             if (bradley.net == null) return null;              if (SpecialTrain.WorkcartEntityNetIDToSpecialTrain.ContainsKey(target.net.ID.Value))             {                 return false;             }              return null;         }          private object CanHelicopterTarget(PatrolHelicopterAI heli, BasePlayer target)         {             if (Instance == null) return null;             if (heli == null) return null;             if (target == null) return null;             if (target.net == null) return null;              if (SpecialTrain.WorkcartEntityNetIDToSpecialTrain.ContainsKey(target.net.ID.Value))             {                 return false;             }              if (SpecialTrain.TrainDriverNetIDToSpecialTrain.ContainsKey(target.net.ID.Value))             {                 return false;             }              return null;         }          private object OnNpcTarget(BasePlayer attacker, BasePlayer target)         {             if (Instance == null) return null;             if (attacker == null) return null;             if (target == null) return null;             if (target.net == null) return null;             if (attacker.net == null) return null;               //Drivers will never be targets nor target anything and we can skip a lot of logic              if (SpecialTrain.TrainDriverNetIDToSpecialTrain.ContainsKey(target.net.ID.Value))             {                 return true;             }              if (SpecialTrain.TrainDriverNetIDToSpecialTrain.ContainsKey(attacker.net.ID.Value))             {                 return true;             }              //attacker and target might or might not belong to the train              bool attackerIsSpecial = SpecialTrain.WorkcartEntityNetIDToSpecialTrain.ContainsKey(attacker.net.ID.Value) || SpecialTrain.TrainDriverNetIDToSpecialTrain.ContainsKey(attacker.net.ID.Value);             bool targetIsSpecial = SpecialTrain.WorkcartEntityNetIDToSpecialTrain.ContainsKey(target.net.ID.Value) || SpecialTrain.TrainDriverNetIDToSpecialTrain.ContainsKey(target.net.ID.Value);              if (attackerIsSpecial && targetIsSpecial)             {                 //specials don't target specials                 return true;             }              //none of them are special? outside of the scope of the plugin, then             if (!(attackerIsSpecial || targetIsSpecial))             {                 return null;             }              bool targetIsAlivePlayer = false;              var alivePlayer = target as BasePlayer;              if (alivePlayer != null)             {                 targetIsAlivePlayer = !alivePlayer.IsNpc;             }              //at this point, the attacker can be special, the target can be special or the target is aliveplayer             //second, who is the target? a tunnel dweller? then don't targe              if (targetIsAlivePlayer)             {                 //default rules                 return null;             }             else if (attackerIsSpecial)             {                 //is the target a tunnel dweller?                  //not a special target, so let's see...                 if (!targetIsSpecial)                 {                     if (target.PrefabName.Contains(\"tunneldweller\"))                     {                         //let the targetting through                         if (configData.ScientistsTargetTunnelDwellers)                         {                             //default targetting rules                             return null;                         }                         else                         {                             return true;                         }                     }                     else //nope it's not a tunnel dweller, so default targetting rules apply                     {                         return null;                     }                 }                 else //special attacker AND special target, so don't let that happen                 {                     return true;                 }             }             else //not a special attacker             {                 if (targetIsSpecial)                 {                     //something non special is trying to target something special.                     //don't let it through                     return true;                 }             }              //anything else: default targetting rules apply             return null;         }                   private void OnEntityKill(BaseEntity entity)         {             if (Instance == null) return;              if (entity == null) return;              if (entity.net == null) return;              if (!SpecialTrain.WorkcartEntityNetIDToSpecialTrain.ContainsKey(entity.net.ID.Value)) return;              //remove the entity from your stuff              SpecialTrain.WorkcartEntityNetIDToSpecialTrain[entity.net.ID.Value].RemoveWorkcartEntity(entity.net.ID.Value);          }          private void OnEntityKill(TrainEngine train)         {             if (Instance == null) return;              SpecialTrain.TrainNetIDToTrainEngine.Remove(train.net.ID.Value);               if (IsTrainSpecial(train.net.ID.Value))             {                 MakeTrainNormal(train.net.ID.Value);             }          }          private void Unload()         {             if (Instance == null) return;              foreach (var specialTrain in SpecialTrain.TrainNetIDToSpecialTrain.Values.ToList())             {                 UnityEngine.Object.DestroyImmediate(specialTrain);             }              SpecialTrain.TrainDriverNetIDToSpecialTrain = null;              SpecialTrain.TrainNetIDToSpecialTrain = null;             SpecialTrain.TrainNetIDToTrainEngine = null;             SpecialTrain.WorkcartEntityNetIDToSpecialTrain = null;              SpecialTrain.PlatformTriggerToTrain = null;              SpecialTrain.UserIDToSpecialTrains = null;              if (EventTimer != null)             {                 EventTimer.Destroy();                 EventTimer = null;             }              ConfigValues = null;              Instance = null;         }          private void OnPlayerTruePVECleanup(BasePlayer player)         {             if (TruePVEIsLoaded)             {                 if (SpecialTrain.UserIDToSpecialTrains.ContainsKey(player.userID))                 {                     foreach (var train in SpecialTrain.UserIDToSpecialTrains[player.userID].ToList())                     {                         if (train != null)                         {                             if (train.PlayersInTruePVEBubble.ContainsKey(player.userID))                             {                                 train.PlayersInTruePVEBubble.Remove(player.userID);                             }                         }                     }                      SpecialTrain.UserIDToSpecialTrains.Remove(player.userID);                 }             }         }          private object OnDeathNotice(Dictionary<string, object> dic, string msg)         {             if (dic == null) return null;              if (!dic.ContainsKey(\"HitInfo\"))             {                 return null;             }              var hit = dic[\"HitInfo\"] as HitInfo;              if (hit.InitiatorPlayer == null)             {                 return null;             }              var victim = hit.HitEntity as BasePlayer;              if (victim == null)             {                 return null;             }              if (hit.InitiatorPlayer.displayName == Instance.configData.TrainDriverName)             {                 return false;             }              if (victim.displayName == Instance.configData.TrainDriverName)             {                 return false;             }              return null;         }          private void OnPlayerDeath(BasePlayer player, HitInfo info)         {             if (Instance == null) return;              OnPlayerTruePVECleanup(player);              //ignore non-drivers here             if (!SpecialTrain.TrainDriverNetIDToSpecialTrain.ContainsKey(player.net.ID.Value))             {                 return;             }              SpecialTrain.TrainDriverNetIDToSpecialTrain[player.net.ID.Value].OnTrainDriverKilled(info);         }          private void OnPlayerDisconnect(BasePlayer player)         {             if (Instance == null) return;              OnPlayerTruePVECleanup(player);         }          private object OnEntityTakeDamage(BaseCombatEntity combatEntity, HitInfo info)         {             if (Instance == null) return null;             if (combatEntity == null) return null;             if (combatEntity.net == null) return null;             if (info == null) return null;              if (SpecialTrain.WorkcartEntityNetIDToSpecialTrain.ContainsKey(combatEntity.net.ID.Value))             {                 return SpecialTrain.WorkcartEntityNetIDToSpecialTrain[combatEntity.net.ID.Value].OnTrainEntityTakeDamage(combatEntity, info);             }              if (SpecialTrain.TrainDriverNetIDToSpecialTrain.ContainsKey(combatEntity.net.ID.Value))             {                 return SpecialTrain.TrainDriverNetIDToSpecialTrain[combatEntity.net.ID.Value].OnTrainEntityTakeDamage(combatEntity, info);             }              //don't let them damage splats             if (combatEntity.PrefabName == PREFAB_RUG && combatEntity.skinID == SKIN_SPLAT1)             {                 return true;             }              return null;         }          private object OnEntityTakeDamage(TrainEngine train, HitInfo info)         {             if (Instance == null) return null;             if (SpecialTrain.TrainNetIDToSpecialTrain.ContainsKey(train.net.ID.Value))             {                 return SpecialTrain.TrainNetIDToSpecialTrain[train.net.ID.Value].OnTrainEntityTakeDamage(train, info);             }              return null;         }         //broken from the December 2021 forced wipe         /*         private object OnFuelAbstract(EntityFuelSystem fuelSystem, object returnOnSuccess)         {             if (Instance == null) return null;              if (fuelSystem.owner.OwnerID != INTERNAL_OWNERID) return null;              if (!SpecialTrain.TrainNetIDToSpecialTrain.ContainsKey(fuelSystem.owner.net.ID))             {                 return null;             }              //no infinite fuel if the driver is dead              if (!SpecialTrain.TrainNetIDToSpecialTrain[fuelSystem.owner.net.ID].DriverIsAlive)             {                 return null;             }              return returnOnSuccess;         }          private object OnFuelCheck(EntityFuelSystem fuelSystem) => OnFuelAbstract(fuelSystem, true);          private object CanUseFuel(EntityFuelSystem fuelSystem, StorageContainer container, float seconds, float fuelUsedPerSecond) => OnFuelCheck(fuelSystem);          object OnFuelAmountCheck(EntityFuelSystem fuelSystem, Item item) => OnFuelAbstract(fuelSystem, 1337);         */         #endregion          #region PERMISSION         public const string PERM_ADMIN = \"cargotrainevent.admin\";         #endregion          #region LANG         public const string MSG_FUEL_MANAGER_PRESENT = \"MSG_FUEL_MANAGER_PRESENT\";         public const string MSG_FUEL_MANAGER_NOT_PRESENT = \"MSG_FUEL_MANAGER_NOT_PRESENT\";         public const string MSG_CHAT_PREFIX = \"MSG_CHAT_PREFIX\";         public const string MSG_EVENT_SCHEDULED_IN = \"MSG_EVENT_SCHEDULED_IN\";         public const string MSG_EVENT_SCHEDULE_DISABLED = \"MSG_EVENT_SCHEDULE_DISABLED\";         public const string MSG_EVENT_STARTED = \"MSG_EVENT_STARTED\";         public const string MSG_EVENT_UPDATE_POSITION = \"MSG_EVENT_UPDATE_POSITION\";         public const string MSG_EVENT_OVER = \"MSG_EVENT_OVER\";         public const string MSG_EVENT_DRIVER_DEAD = \"MSG_EVENT_DRIVER_DEAD\";         public const string MSG_EVENT_CRATE_BEING_HACKED = \"MSG_EVENT_CRATE_BEING_HACKED\";         public const string MSG_EVENT_SELF_DESTRUCT_INITIATED = \"MSG_EVENT_SELF_DESTRUCT_INITIATED\";         public const string MSG_FORMAT_TIME_BOTH = \"MSG_FORMAT_TIME_BOTH\";         public const string MSG_FORMAT_TIME_SEC = \"MSG_FORMAT_TIME_SEC\";         public const string MSG_FORMAT_TIME_MIN = \"MSG_FORMAT_TIME_MIN\";         public const string MSG_AVAILABLE_CAMERAS = \"MSG_AVAILABLE_CAMERAS\";         public const string MSG_AVAILABLE_CAMERAS2 = \"MSG_AVAILABLE_CAMERAS2\";          public const string MSG_VALUE_HAS_BEEN_SET = \"MSG_VALUE_HAS_BEEN_SET\";          private const string MSG_CFG_DEFAULT = \"MSG_CFG_DEFAULT\";         private const string MSG_CFG_RUNDOWN_FORMAT = \"MSG_CFG_RUNDOWN_FORMAT\";         private const string MSG_CFG_DETAILS_FORMAT = \"MSG_CFG_DETAILS_FORMAT\";         private const string MSG_CFG_NO_SETTING_FOUND = \"MSG_CFG_NO_SETTING_FOUND\";          private Dictionary<string, string> LangMessages = new Dictionary<string, string>         {             [MSG_FUEL_MANAGER_PRESENT] = \"Fuel Manager v. {0} loaded; handing over fuel handling\",             [MSG_FUEL_MANAGER_NOT_PRESENT] = \"Fuel Manager not loaded, using default handling\",             [MSG_CHAT_PREFIX] = \"<color=red>[Cargo Train Event]</color>\",             [MSG_EVENT_SCHEDULE_DISABLED] = \"Not scheduling the next Cargo Train Event - the built-in event timer is disabled. You will need to run the command manually.\",             [MSG_EVENT_SCHEDULED_IN] = \"The next Cargo Train Event has been scheduled to run {0} seconds (= {1} minutes) from now.\",             [MSG_EVENT_STARTED] = \"Cargo Workcart inbound at <color=yellow>{0}</color>!\",             [MSG_EVENT_UPDATE_POSITION] = \"Cargo Workcart is currently at <color=yellow>{0}</color>!\",             [MSG_EVENT_OVER] = \"The Cargo Workcart event is over!\",             [MSG_EVENT_DRIVER_DEAD] = \"The original driver of the Cargo Workcart has been taken out!\",             [MSG_EVENT_CRATE_BEING_HACKED] = \"Somebody started hacking the locked crate on the Cargo Workcart!\",             [MSG_EVENT_SELF_DESTRUCT_INITIATED] = \"The Cargo Workcart will self-destruct in {0}!\",             [MSG_FORMAT_TIME_BOTH] = \"{0} m {1} s\",             [MSG_FORMAT_TIME_SEC] = \"{0} s\",             [MSG_FORMAT_TIME_MIN] = \"{0} m\",             [MSG_AVAILABLE_CAMERAS] = \"The following CCTV identifiers have been assigned:{0}\",             [MSG_AVAILABLE_CAMERAS2] = \"Event CCTVS: \",              [MSG_VALUE_HAS_BEEN_SET] = \"Config value <color=yellow>{0}</color> has been set to {1} by an admin.\",             [MSG_CFG_DEFAULT] = \"Here's the current settings. Type <color=yellow>/te_cfg settingName</color> with no parameters to see the description, the current value and what the accepted arguments are. Type <color=yellow>/te_cfg settingName acceptedValue</color> to change the setting.\",             [MSG_CFG_RUNDOWN_FORMAT] = \"/te_cfg <color=yellow>{0}</color> (currently: {1})\",             [MSG_CFG_DETAILS_FORMAT] = \"<color=green>{0}</color>:\\n{1} ({2})\\nThis value is currently set to: {3}\\n\",             [MSG_CFG_NO_SETTING_FOUND] = \"No setting with that name has been found. Type /te_cfg to get a rundown.\",         };          private static object ReusableObject;         private static bool ReusableBool;         private static string ReusableString;         private static float ReusableFloat;          private static bool ReusableBool2;          private static string ReusableString2;         private static float ReusableFloat2;         private static int ReusableInt2;         private static ulong ReusableUlong2;          private void TellMessage(BasePlayer player, string message, bool alsoPrintWarning = false)         {             ReusableString2 = $\"{MSG(MSG_CHAT_PREFIX)} {message}\";              if (player == null)             {                 if (Instance.configData.UseChatMessages)                 {                     Instance.PrintToChat(ReusableString2);                 }                  if (Instance.configData.UseNotifyPlugin)                 {                     foreach (var playah in BasePlayer.activePlayerList)                     {                         if (!playah.IsConnected)                         {                             continue;                         }                          Interface.Call(\"SendNotify\", playah, (int)0, ReusableString2);                     }                 }                  if (Instance.configData.UseGuiAnnouncements)                 {                     GUIAnnouncements?.Call(\"CreateAnnouncement\", ReusableString2, \"Grey",
      "Plugin version": "White",
      "Link to plugin": "",
      "Marketplace": "",
      "Ignore": false
    }

 

tofurahie

Posted

6 minutes ago, dustyhansen said:

Do you have Cargo Train Event? It looks like there is a messed up entry in my config file for this plugin:

    {
      "Name": "ColorCode{publicstringhexValue;publicUnityEngine.ColorrustValue;publicstringrustString;publicColorCode(stringhex){hexValue=hex.ToUpper();if(hex.StartsWith(\"#\")){hex=hex.Substring(1);}if(!hexValue.StartsWith(\"#\")){hexValue=\"#\"+hexValue;}//extracttheR,G,Bfloatr=255F,g=0,b=0;try{r=(float)short.Parse(hex.Substring(0,2),System.Globalization.NumberStyles.HexNumber)/255;g=(float)short.Parse(hex.Substring(2,2),System.Globalization.NumberStyles.HexNumber)/255;b=(float)short.Parse(hex.Substring(4,2),System.Globalization.NumberStyles.HexNumber)/255;}catch{Instance.PrintError($\"ERROR",
      "Author": "Nikedemos\", VERSION)]     [Description(\"Just like Cargo Ships - but with trains\")]     public class CargoTrainEvent : RustPlugin     {         private static CargoTrainEvent Instance;         private static Timer EventTimer;          [PluginReference]         private Plugin Kits, FuelManager, TruePVE, DeathNotes, GUIAnnouncements;          #region CONST & STATIC         public const string VERSION = \"1.0.18\";         public const ulong INTERNAL_SKIN = 2847372289;          public const string PREFAB_DRIVER = \"assets/rust.ai/agents/npcplayer/humannpc/scientist/scientistnpc_cargo_turret_any.prefab\";         public const string PREFAB_SCIENTIST = \"assets/rust.ai/agents/npcplayer/humannpc/scientist/scientistnpc_cargo_turret_any.prefab\";          public const string PREFAB_WORKCART = \"assets/content/vehicles/workcart/workcart.entity.prefab\";         public const string PREFAB_LOCOMOTIVE = \"assets/content/vehicles/trains/locomotive/locomotive.entity.prefab\";         public const string PREFAB_SEDAN_TRAIN = \"assets/content/vehicles/sedan_a/sedanrail.entity.prefab\";         public const string PREFAB_ABOVEGROUND_TRAIN = \"assets/content/vehicles/workcart/workcart_aboveground.entity.prefab\";         public const string PREFAB_ABOVEGROUND_TRAIN_2 = \"assets/content/vehicles/workcart/workcart_aboveground2.entity.prefab\";          public const string PREFAB_CRATE_LOCKED = \"assets/prefabs/deployable/chinooklockedcrate/codelockedhackablecrate.prefab\";         public const string PREFAB_CRATE_ELITE = \"assets/bundled/prefabs/radtown/crate_elite.prefab\";         public const string PREFAB_CRATE_BRADLEY = \"assets/prefabs/npc/m2bradley/bradley_crate.prefab\";         public const string PREFAB_CRATE_HELI = \"assets/prefabs/npc/patrol helicopter/heli_crate.prefab\";         public const string PREFAB_CRATE_MARKER = \"assets/prefabs/tools/map/cratemarker.prefab\";         public const string PREFAB_GENERIC_MARKER = \"assets/prefabs/tools/map/genericradiusmarker.prefab\";         public const string PREFAB_RUG = \"assets/prefabs/deployable/rug/rug.deployed.prefab\";         public const string PREFAB_SIRENLIGHT = \"assets/prefabs/deployable/playerioents/lights/sirenlight/electric.sirenlight.deployed.prefab\";         public const string PREFAB_COUNTER = \"assets/prefabs/deployable/playerioents/counter/counter.prefab\";         public const string PREFAB_ALARM = \"assets/prefabs/deployable/playerioents/alarms/audioalarm.prefab\";         public const string PREFAB_CCTV = \"assets/prefabs/deployable/cctvcamera/cctv_deployed.prefab\";          public const string FX_C4_EXPLOSION = \"assets/prefabs/tools/c4/effects/c4_explosion.prefab\";         public const string FX_EXPLOSION_01 = \"assets/bundled/prefabs/fx/explosions/explosion_01.prefab\";         public const string FX_EXPLOSION_02 = \"assets/bundled/prefabs/fx/explosions/explosion_02.prefab\";         public const string FX_EXPLOSION_03 = \"assets/bundled/prefabs/fx/explosions/explosion_03.prefab\";          public const ulong SKIN_SPLAT1 = 2451067899;          public const int ITEM_SNOWBALL = -363689972;         public const int ITEM_SUIT_HEAVY = -1772746857;         public const int ITEM_LOWGRADE = -946369541;          #endregion          #region HOOKS         private void Init()         {             Instance = null;         }          private void OnServerInitialized()         {             Instance = this;             lang.RegisterMessages(LangMessages, this);              permission.RegisterPermission(PERM_ADMIN, this);              LoadConfigData();             ProcessConfigData();              ConfigValues = new Dictionary<string, InteractiveConfigValue>();              GenerateAllInteractiveConfigValues();              SpecialTrain.TrainDriverNetIDToSpecialTrain = new Dictionary<ulong, SpecialTrain>();              SpecialTrain.TrainNetIDToSpecialTrain = new Dictionary<ulong, SpecialTrain>();             SpecialTrain.TrainNetIDToTrainEngine = new Dictionary<ulong, TrainEngine>();             SpecialTrain.WorkcartEntityNetIDToSpecialTrain = new Dictionary<ulong, SpecialTrain>();              SpecialTrain.PlatformTriggerToTrain = new Dictionary<TriggerBase, SpecialTrain>();              SpecialTrain.UserIDToSpecialTrains = new Dictionary<ulong, List<SpecialTrain>>();              //pre-cleanup              foreach (var entity in BaseNetworkable.serverEntities.OfType<BaseEntity>().Where(e => e.skinID == INTERNAL_SKIN || e.skinID == SKIN_SPLAT1))             {                 entity.Kill(BaseNetworkable.DestroyMode.None);             }              foreach (var train in BaseNetworkable.serverEntities.OfType<TrainEngine>())             {                 OnEntitySpawned(train);             }              //broken from December 2021 forced wipe             //FuelManagerCheck();             TruePVECheck();             DeathNotesCheck();              ScheduleTrainEventAtRandom();         }           private void OnBookmarkControlStarted(ComputerStation station, BasePlayer player, string text, CCTV_RC cctv)         {             if (cctv == null) return;              if (cctv.skinID != INTERNAL_SKIN) return;              var group = Network.Net.sv.visibility.GetGroup(cctv.transform.position);              player.net.SwitchSecondaryGroup(group);              Interface.CallHook(\"OnBookmarkControlStartedTrainCCTV\", player, text, cctv);         }          private void OnEntitySpawned(TrainEngine train)         {             if (Instance == null) return;              if (train.PrefabName == PREFAB_LOCOMOTIVE)             {                 return;             }              SpecialTrain.TrainNetIDToTrainEngine.Add(train.net.ID.Value, train);              train.SetFlag(TrainEngine.Flag_AltColor, false);             train.SendNetworkUpdateImmediate();         }          private void OnCrateHack(HackableLockedCrate crate)         {             if (Instance == null) return;              if (crate.skinID != INTERNAL_SKIN) return;              if (!SpecialTrain.WorkcartEntityNetIDToSpecialTrain.ContainsKey(crate.net.ID.Value)) return;               SpecialTrain.WorkcartEntityNetIDToSpecialTrain[crate.net.ID.Value].OnCrateHack(crate);              Interface.CallHook(\"OnTrainCrateHack\", SpecialTrain.WorkcartEntityNetIDToSpecialTrain[crate.net.ID.Value].Train, crate);          }          object OnCounterModeToggle(PowerCounter counter, BasePlayer player, bool wants)         {             if (Instance == null) return null;              if (counter.skinID != INTERNAL_SKIN) return null;              return false;         }          private object CanBeWounded(BasePlayer player)         {             if (Instance == null) return null;             if (!SpecialTrain.TrainDriverNetIDToSpecialTrain.ContainsKey(player.net.ID.Value))             {                 return null;             }              //drivers can't be wounded             return false;         }         private object OnTurretTarget(AutoTurret turret, ScientistNPC target)         {             if (Instance == null) return null;             if (turret == null) return null;             if (turret.net == null) return null;             if (target == null) return null;             if (target.net == null) return null;              if (SpecialTrain.WorkcartEntityNetIDToSpecialTrain.ContainsKey(target.net.ID.Value))             {                 return false;             }              return null;         }          private object CanBradleyApcTarget(BradleyAPC bradley, ScientistNPC target)         {             if (Instance == null) return null;             if (bradley == null) return null;             if (target == null) return null;             if (target.net == null) return null;             if (bradley.net == null) return null;              if (SpecialTrain.WorkcartEntityNetIDToSpecialTrain.ContainsKey(target.net.ID.Value))             {                 return false;             }              return null;         }          private object CanHelicopterTarget(PatrolHelicopterAI heli, BasePlayer target)         {             if (Instance == null) return null;             if (heli == null) return null;             if (target == null) return null;             if (target.net == null) return null;              if (SpecialTrain.WorkcartEntityNetIDToSpecialTrain.ContainsKey(target.net.ID.Value))             {                 return false;             }              if (SpecialTrain.TrainDriverNetIDToSpecialTrain.ContainsKey(target.net.ID.Value))             {                 return false;             }              return null;         }          private object OnNpcTarget(BasePlayer attacker, BasePlayer target)         {             if (Instance == null) return null;             if (attacker == null) return null;             if (target == null) return null;             if (target.net == null) return null;             if (attacker.net == null) return null;               //Drivers will never be targets nor target anything and we can skip a lot of logic              if (SpecialTrain.TrainDriverNetIDToSpecialTrain.ContainsKey(target.net.ID.Value))             {                 return true;             }              if (SpecialTrain.TrainDriverNetIDToSpecialTrain.ContainsKey(attacker.net.ID.Value))             {                 return true;             }              //attacker and target might or might not belong to the train              bool attackerIsSpecial = SpecialTrain.WorkcartEntityNetIDToSpecialTrain.ContainsKey(attacker.net.ID.Value) || SpecialTrain.TrainDriverNetIDToSpecialTrain.ContainsKey(attacker.net.ID.Value);             bool targetIsSpecial = SpecialTrain.WorkcartEntityNetIDToSpecialTrain.ContainsKey(target.net.ID.Value) || SpecialTrain.TrainDriverNetIDToSpecialTrain.ContainsKey(target.net.ID.Value);              if (attackerIsSpecial && targetIsSpecial)             {                 //specials don't target specials                 return true;             }              //none of them are special? outside of the scope of the plugin, then             if (!(attackerIsSpecial || targetIsSpecial))             {                 return null;             }              bool targetIsAlivePlayer = false;              var alivePlayer = target as BasePlayer;              if (alivePlayer != null)             {                 targetIsAlivePlayer = !alivePlayer.IsNpc;             }              //at this point, the attacker can be special, the target can be special or the target is aliveplayer             //second, who is the target? a tunnel dweller? then don't targe              if (targetIsAlivePlayer)             {                 //default rules                 return null;             }             else if (attackerIsSpecial)             {                 //is the target a tunnel dweller?                  //not a special target, so let's see...                 if (!targetIsSpecial)                 {                     if (target.PrefabName.Contains(\"tunneldweller\"))                     {                         //let the targetting through                         if (configData.ScientistsTargetTunnelDwellers)                         {                             //default targetting rules                             return null;                         }                         else                         {                             return true;                         }                     }                     else //nope it's not a tunnel dweller, so default targetting rules apply                     {                         return null;                     }                 }                 else //special attacker AND special target, so don't let that happen                 {                     return true;                 }             }             else //not a special attacker             {                 if (targetIsSpecial)                 {                     //something non special is trying to target something special.                     //don't let it through                     return true;                 }             }              //anything else: default targetting rules apply             return null;         }                   private void OnEntityKill(BaseEntity entity)         {             if (Instance == null) return;              if (entity == null) return;              if (entity.net == null) return;              if (!SpecialTrain.WorkcartEntityNetIDToSpecialTrain.ContainsKey(entity.net.ID.Value)) return;              //remove the entity from your stuff              SpecialTrain.WorkcartEntityNetIDToSpecialTrain[entity.net.ID.Value].RemoveWorkcartEntity(entity.net.ID.Value);          }          private void OnEntityKill(TrainEngine train)         {             if (Instance == null) return;              SpecialTrain.TrainNetIDToTrainEngine.Remove(train.net.ID.Value);               if (IsTrainSpecial(train.net.ID.Value))             {                 MakeTrainNormal(train.net.ID.Value);             }          }          private void Unload()         {             if (Instance == null) return;              foreach (var specialTrain in SpecialTrain.TrainNetIDToSpecialTrain.Values.ToList())             {                 UnityEngine.Object.DestroyImmediate(specialTrain);             }              SpecialTrain.TrainDriverNetIDToSpecialTrain = null;              SpecialTrain.TrainNetIDToSpecialTrain = null;             SpecialTrain.TrainNetIDToTrainEngine = null;             SpecialTrain.WorkcartEntityNetIDToSpecialTrain = null;              SpecialTrain.PlatformTriggerToTrain = null;              SpecialTrain.UserIDToSpecialTrains = null;              if (EventTimer != null)             {                 EventTimer.Destroy();                 EventTimer = null;             }              ConfigValues = null;              Instance = null;         }          private void OnPlayerTruePVECleanup(BasePlayer player)         {             if (TruePVEIsLoaded)             {                 if (SpecialTrain.UserIDToSpecialTrains.ContainsKey(player.userID))                 {                     foreach (var train in SpecialTrain.UserIDToSpecialTrains[player.userID].ToList())                     {                         if (train != null)                         {                             if (train.PlayersInTruePVEBubble.ContainsKey(player.userID))                             {                                 train.PlayersInTruePVEBubble.Remove(player.userID);                             }                         }                     }                      SpecialTrain.UserIDToSpecialTrains.Remove(player.userID);                 }             }         }          private object OnDeathNotice(Dictionary<string, object> dic, string msg)         {             if (dic == null) return null;              if (!dic.ContainsKey(\"HitInfo\"))             {                 return null;             }              var hit = dic[\"HitInfo\"] as HitInfo;              if (hit.InitiatorPlayer == null)             {                 return null;             }              var victim = hit.HitEntity as BasePlayer;              if (victim == null)             {                 return null;             }              if (hit.InitiatorPlayer.displayName == Instance.configData.TrainDriverName)             {                 return false;             }              if (victim.displayName == Instance.configData.TrainDriverName)             {                 return false;             }              return null;         }          private void OnPlayerDeath(BasePlayer player, HitInfo info)         {             if (Instance == null) return;              OnPlayerTruePVECleanup(player);              //ignore non-drivers here             if (!SpecialTrain.TrainDriverNetIDToSpecialTrain.ContainsKey(player.net.ID.Value))             {                 return;             }              SpecialTrain.TrainDriverNetIDToSpecialTrain[player.net.ID.Value].OnTrainDriverKilled(info);         }          private void OnPlayerDisconnect(BasePlayer player)         {             if (Instance == null) return;              OnPlayerTruePVECleanup(player);         }          private object OnEntityTakeDamage(BaseCombatEntity combatEntity, HitInfo info)         {             if (Instance == null) return null;             if (combatEntity == null) return null;             if (combatEntity.net == null) return null;             if (info == null) return null;              if (SpecialTrain.WorkcartEntityNetIDToSpecialTrain.ContainsKey(combatEntity.net.ID.Value))             {                 return SpecialTrain.WorkcartEntityNetIDToSpecialTrain[combatEntity.net.ID.Value].OnTrainEntityTakeDamage(combatEntity, info);             }              if (SpecialTrain.TrainDriverNetIDToSpecialTrain.ContainsKey(combatEntity.net.ID.Value))             {                 return SpecialTrain.TrainDriverNetIDToSpecialTrain[combatEntity.net.ID.Value].OnTrainEntityTakeDamage(combatEntity, info);             }              //don't let them damage splats             if (combatEntity.PrefabName == PREFAB_RUG && combatEntity.skinID == SKIN_SPLAT1)             {                 return true;             }              return null;         }          private object OnEntityTakeDamage(TrainEngine train, HitInfo info)         {             if (Instance == null) return null;             if (SpecialTrain.TrainNetIDToSpecialTrain.ContainsKey(train.net.ID.Value))             {                 return SpecialTrain.TrainNetIDToSpecialTrain[train.net.ID.Value].OnTrainEntityTakeDamage(train, info);             }              return null;         }         //broken from the December 2021 forced wipe         /*         private object OnFuelAbstract(EntityFuelSystem fuelSystem, object returnOnSuccess)         {             if (Instance == null) return null;              if (fuelSystem.owner.OwnerID != INTERNAL_OWNERID) return null;              if (!SpecialTrain.TrainNetIDToSpecialTrain.ContainsKey(fuelSystem.owner.net.ID))             {                 return null;             }              //no infinite fuel if the driver is dead              if (!SpecialTrain.TrainNetIDToSpecialTrain[fuelSystem.owner.net.ID].DriverIsAlive)             {                 return null;             }              return returnOnSuccess;         }          private object OnFuelCheck(EntityFuelSystem fuelSystem) => OnFuelAbstract(fuelSystem, true);          private object CanUseFuel(EntityFuelSystem fuelSystem, StorageContainer container, float seconds, float fuelUsedPerSecond) => OnFuelCheck(fuelSystem);          object OnFuelAmountCheck(EntityFuelSystem fuelSystem, Item item) => OnFuelAbstract(fuelSystem, 1337);         */         #endregion          #region PERMISSION         public const string PERM_ADMIN = \"cargotrainevent.admin\";         #endregion          #region LANG         public const string MSG_FUEL_MANAGER_PRESENT = \"MSG_FUEL_MANAGER_PRESENT\";         public const string MSG_FUEL_MANAGER_NOT_PRESENT = \"MSG_FUEL_MANAGER_NOT_PRESENT\";         public const string MSG_CHAT_PREFIX = \"MSG_CHAT_PREFIX\";         public const string MSG_EVENT_SCHEDULED_IN = \"MSG_EVENT_SCHEDULED_IN\";         public const string MSG_EVENT_SCHEDULE_DISABLED = \"MSG_EVENT_SCHEDULE_DISABLED\";         public const string MSG_EVENT_STARTED = \"MSG_EVENT_STARTED\";         public const string MSG_EVENT_UPDATE_POSITION = \"MSG_EVENT_UPDATE_POSITION\";         public const string MSG_EVENT_OVER = \"MSG_EVENT_OVER\";         public const string MSG_EVENT_DRIVER_DEAD = \"MSG_EVENT_DRIVER_DEAD\";         public const string MSG_EVENT_CRATE_BEING_HACKED = \"MSG_EVENT_CRATE_BEING_HACKED\";         public const string MSG_EVENT_SELF_DESTRUCT_INITIATED = \"MSG_EVENT_SELF_DESTRUCT_INITIATED\";         public const string MSG_FORMAT_TIME_BOTH = \"MSG_FORMAT_TIME_BOTH\";         public const string MSG_FORMAT_TIME_SEC = \"MSG_FORMAT_TIME_SEC\";         public const string MSG_FORMAT_TIME_MIN = \"MSG_FORMAT_TIME_MIN\";         public const string MSG_AVAILABLE_CAMERAS = \"MSG_AVAILABLE_CAMERAS\";         public const string MSG_AVAILABLE_CAMERAS2 = \"MSG_AVAILABLE_CAMERAS2\";          public const string MSG_VALUE_HAS_BEEN_SET = \"MSG_VALUE_HAS_BEEN_SET\";          private const string MSG_CFG_DEFAULT = \"MSG_CFG_DEFAULT\";         private const string MSG_CFG_RUNDOWN_FORMAT = \"MSG_CFG_RUNDOWN_FORMAT\";         private const string MSG_CFG_DETAILS_FORMAT = \"MSG_CFG_DETAILS_FORMAT\";         private const string MSG_CFG_NO_SETTING_FOUND = \"MSG_CFG_NO_SETTING_FOUND\";          private Dictionary<string, string> LangMessages = new Dictionary<string, string>         {             [MSG_FUEL_MANAGER_PRESENT] = \"Fuel Manager v. {0} loaded; handing over fuel handling\",             [MSG_FUEL_MANAGER_NOT_PRESENT] = \"Fuel Manager not loaded, using default handling\",             [MSG_CHAT_PREFIX] = \"<color=red>[Cargo Train Event]</color>\",             [MSG_EVENT_SCHEDULE_DISABLED] = \"Not scheduling the next Cargo Train Event - the built-in event timer is disabled. You will need to run the command manually.\",             [MSG_EVENT_SCHEDULED_IN] = \"The next Cargo Train Event has been scheduled to run {0} seconds (= {1} minutes) from now.\",             [MSG_EVENT_STARTED] = \"Cargo Workcart inbound at <color=yellow>{0}</color>!\",             [MSG_EVENT_UPDATE_POSITION] = \"Cargo Workcart is currently at <color=yellow>{0}</color>!\",             [MSG_EVENT_OVER] = \"The Cargo Workcart event is over!\",             [MSG_EVENT_DRIVER_DEAD] = \"The original driver of the Cargo Workcart has been taken out!\",             [MSG_EVENT_CRATE_BEING_HACKED] = \"Somebody started hacking the locked crate on the Cargo Workcart!\",             [MSG_EVENT_SELF_DESTRUCT_INITIATED] = \"The Cargo Workcart will self-destruct in {0}!\",             [MSG_FORMAT_TIME_BOTH] = \"{0} m {1} s\",             [MSG_FORMAT_TIME_SEC] = \"{0} s\",             [MSG_FORMAT_TIME_MIN] = \"{0} m\",             [MSG_AVAILABLE_CAMERAS] = \"The following CCTV identifiers have been assigned:{0}\",             [MSG_AVAILABLE_CAMERAS2] = \"Event CCTVS: \",              [MSG_VALUE_HAS_BEEN_SET] = \"Config value <color=yellow>{0}</color> has been set to {1} by an admin.\",             [MSG_CFG_DEFAULT] = \"Here's the current settings. Type <color=yellow>/te_cfg settingName</color> with no parameters to see the description, the current value and what the accepted arguments are. Type <color=yellow>/te_cfg settingName acceptedValue</color> to change the setting.\",             [MSG_CFG_RUNDOWN_FORMAT] = \"/te_cfg <color=yellow>{0}</color> (currently: {1})\",             [MSG_CFG_DETAILS_FORMAT] = \"<color=green>{0}</color>:\\n{1} ({2})\\nThis value is currently set to: {3}\\n\",             [MSG_CFG_NO_SETTING_FOUND] = \"No setting with that name has been found. Type /te_cfg to get a rundown.\",         };          private static object ReusableObject;         private static bool ReusableBool;         private static string ReusableString;         private static float ReusableFloat;          private static bool ReusableBool2;          private static string ReusableString2;         private static float ReusableFloat2;         private static int ReusableInt2;         private static ulong ReusableUlong2;          private void TellMessage(BasePlayer player, string message, bool alsoPrintWarning = false)         {             ReusableString2 = $\"{MSG(MSG_CHAT_PREFIX)} {message}\";              if (player == null)             {                 if (Instance.configData.UseChatMessages)                 {                     Instance.PrintToChat(ReusableString2);                 }                  if (Instance.configData.UseNotifyPlugin)                 {                     foreach (var playah in BasePlayer.activePlayerList)                     {                         if (!playah.IsConnected)                         {                             continue;                         }                          Interface.Call(\"SendNotify\", playah, (int)0, ReusableString2);                     }                 }                  if (Instance.configData.UseGuiAnnouncements)                 {                     GUIAnnouncements?.Call(\"CreateAnnouncement\", ReusableString2, \"Grey",
      "Plugin version": "White",
      "Link to plugin": "",
      "Marketplace": "",
      "Ignore": false
    }

 

oh will fix it

tofurahie

Posted

Changed Status from Pending to Closed

Changed Fixed In to Next Version

dustyhansen

Posted (edited)

9 hours ago, tofurahie said:

oh will fix it

This is fixed now, but the Not Loaded is not working now.

Screenshot 2024-11-17 070719.png

Edited by dustyhansen
typo
1.4m

Downloads

Total number of downloads.

6.9k

Customers

Total customers served.

102.4k

Files Sold

Total number of files sold.

2.1m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.