Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Newtonsoft.Json;
- namespace Oxide.Plugins
- {
- [Info("Health Vehicles", "SwenenzY", "1.1.0")]
- [Description("Raises vehicles health.")]
- public class HealthVehicles : RustPlugin
- {
- #region Config
- private ConfigFile _config;
- public class ConfigFile
- {
- // Mini
- [JsonProperty(PropertyName = "Mini start health ( ex : 500 )")]
- public float MiniStartHealth;
- [JsonProperty(PropertyName = "Mini max health ( ex : 1000 )")]
- public float MiniMaxHealth;
- // Scrap
- [JsonProperty(PropertyName = "Scrap start health ( ex : 500 )")]
- public float ScrapStartHealth;
- [JsonProperty(PropertyName = "Scrap max health ( ex : 2000 )")]
- public float ScrapMaxHealth;
- // Balloon
- [JsonProperty(PropertyName = "Balloon start health ( ex : 500 )")]
- public float BalloonStartHealth;
- [JsonProperty(PropertyName = "Balloon max health ( ex : 2000 )")]
- public float BalloonMaxHealth;
- // rhib
- [JsonProperty(PropertyName = "Rhib start health ( ex : 500 )")]
- public float RhibStartHealth;
- [JsonProperty(PropertyName = "Rhib max health ( ex : 500 )")]
- public float RhibMaxHealth;
- // rowboat
- [JsonProperty(PropertyName = "Rowboat start health ( ex : 400 )")]
- public float RowboatStartHealth;
- [JsonProperty(PropertyName = "Rowboat max health ( ex : 400 )")]
- public float RowboatMaxHealth;
- // Tugboat
- [JsonProperty(PropertyName = "Tugboat start health ( ex : 400 )")]
- public float TugboatStartHealth;
- [JsonProperty(PropertyName = "Tugboat max health ( ex : 400 )")]
- public float TugboatMaxHealth;
- // workcart
- [JsonProperty(PropertyName = "Workcart start health ( ex : 1000 )")]
- public float WorkcartStartHealth;
- [JsonProperty(PropertyName = "Workcart max health ( ex : 1000 )")]
- public float WorkcartMaxHealth;
- // TrainCar
- [JsonProperty(PropertyName = "Traincar start health ( ex : 1000 )")]
- public float TraincarStartHealth;
- [JsonProperty(PropertyName = "Traincar max health ( ex : 1000 )")]
- public float TraincarMaxHealth;
- // MagnetCrane
- [JsonProperty(PropertyName = "Magnetcrane start health ( ex : 500 )")]
- public float MagnetcraneStartHealth;
- [JsonProperty(PropertyName = "Magnetcrane max health ( ex : 500 )")]
- public float MagnetcraneMaxHealth;
- // SubSolo
- [JsonProperty(PropertyName = "Submarinesolo start health ( ex : 500 )")]
- public float SubmarinesoloStartHealth;
- [JsonProperty(PropertyName = "Submarinesolo max health ( ex : 500 )")]
- public float SubmarinesoloMaxHealth;
- // SubDuo
- [JsonProperty(PropertyName = "Submarineduo start health ( ex : 700 )")]
- public float SubmarineduoStartHealth;
- [JsonProperty(PropertyName = "Submarineduo max health ( ex : 700 )")]
- public float SubmarineduoMaxHealth;
- // Snowmobile
- [JsonProperty(PropertyName = "Snowmobile start health ( ex : 300 )")]
- public float SnowmobileStartHealth;
- [JsonProperty(PropertyName = "Snowmobile max health ( ex : 300 )")]
- public float SnowmobileMaxHealth;
- // tomhaSnowmobile
- [JsonProperty(PropertyName = "Tomahasnowmobile start health ( ex : 300 )")]
- public float TomahasnowmobileStartHealth;
- [JsonProperty(PropertyName = "Tomahasnowmobile max health ( ex : 300 )")]
- public float TomahasnowmobileMaxHealth;
- // Ch47
- [JsonProperty(PropertyName = "Ch47 start health ( ex : 2000 )")]
- public float Ch47StartHealth;
- [JsonProperty(PropertyName = "Ch47 max health ( ex : 2000 )")]
- public float Ch47MaxHealth;
- public static ConfigFile DefaultConfig()
- {
- return new ConfigFile
- {
- // Mini
- MiniStartHealth = 500f,
- MiniMaxHealth = 1000f,
- // Scrap
- ScrapStartHealth = 500f,
- ScrapMaxHealth = 2000f,
- // Balloon
- BalloonStartHealth = 500f,
- BalloonMaxHealth = 2000f,
- // Rhib
- RhibStartHealth = 500f,
- RhibMaxHealth = 2000f,
- // Rowboat
- RowboatStartHealth = 500f,
- RowboatMaxHealth = 2000f,
- // Tugboat
- TugboatStartHealth = 3000f,
- TugboatMaxHealth = 3000f,
- // Workcart
- WorkcartStartHealth = 500f,
- WorkcartMaxHealth = 2000f,
- // Workcartabove
- TraincarStartHealth = 500f,
- TraincarMaxHealth = 2000f,
- // Magnetcrane
- MagnetcraneStartHealth = 500f,
- MagnetcraneMaxHealth = 2000f,
- // Subsolo
- SubmarinesoloStartHealth = 500f,
- SubmarinesoloMaxHealth = 2000f,
- // Subduo
- SubmarineduoStartHealth = 500f,
- SubmarineduoMaxHealth = 2000f,
- // snowmobile
- SnowmobileStartHealth = 500f,
- SnowmobileMaxHealth = 2000f,
- // tomhaSnowmobile
- TomahasnowmobileStartHealth = 500f,
- TomahasnowmobileMaxHealth = 2000f,
- // Ch47
- Ch47StartHealth = 500f,
- Ch47MaxHealth = 2000f,
- };
- }
- }
- protected override void LoadDefaultConfig() => _config = ConfigFile.DefaultConfig();
- protected override void LoadConfig()
- {
- base.LoadConfig();
- _config = Config.ReadObject<ConfigFile>();
- }
- protected override void SaveConfig() => Config.WriteObject(_config);
- #endregion
- #region Vehicles
- #region Mini Copter
- void OnEntitySpawned(MiniCopter mini)
- {
- if (mini == null)
- {
- return;
- }
- mini.SetMaxHealth(_config.MiniMaxHealth);
- mini._health = _config.MiniStartHealth;
- }
- #endregion
- #region Scrap Copter
- void OnEntitySpawned(ScrapTransportHelicopter scrap)
- {
- if (scrap == null)
- {
- return;
- }
- scrap.SetMaxHealth(_config.ScrapMaxHealth);
- scrap._health = _config.ScrapStartHealth;
- }
- #endregion
- #region Balloon
- void OnEntitySpawned(HotAirBalloon balloon)
- {
- if (balloon == null)
- {
- return;
- }
- balloon.SetMaxHealth(_config.BalloonMaxHealth);
- balloon._health = _config.BalloonStartHealth;
- }
- #endregion
- #region Rhib
- void OnEntitySpawned(RHIB ib)
- {
- if (ib == null)
- {
- return;
- }
- ib.SetMaxHealth(_config.RhibMaxHealth);
- ib._health = _config.RhibStartHealth;
- }
- #endregion
- #region Rowboat
- void OnEntitySpawned(MotorRowboat bt)
- {
- if (bt == null)
- {
- return;
- }
- bt.SetMaxHealth(_config.RowboatMaxHealth);
- bt._health = _config.RowboatStartHealth;
- }
- #endregion
- #region Tugboat
- void OnEntitySpawned(Tugboat tb)
- {
- if (tb == null)
- {
- return;
- }
- tb.SetMaxHealth(_config.TugboatMaxHealth);
- tb._health = _config.TugboatStartHealth;
- }
- #endregion
- #region Workcart
- void OnEntitySpawned(TrainEngine tengine)
- {
- if (tengine == null)
- {
- return;
- }
- tengine.SetMaxHealth(_config.WorkcartMaxHealth);
- tengine._health = _config.WorkcartStartHealth;
- }
- #endregion
- #region TrainCar
- void OnEntitySpawned(TrainCar tcar)
- {
- if (tcar == null)
- {
- return;
- }
- tcar.SetMaxHealth(_config.TraincarMaxHealth);
- tcar._health = _config.TraincarStartHealth;
- }
- #endregion
- #region Magnetcrane
- void OnEntitySpawned(MagnetCrane magnet)
- {
- if (magnet == null)
- {
- return;
- }
- magnet.SetMaxHealth(_config.MagnetcraneMaxHealth);
- magnet._health = _config.MagnetcraneStartHealth;
- }
- #endregion
- #region Submarinesolo
- void OnEntitySpawned(BaseSubmarine sms)
- {
- if (sms == null)
- {
- return;
- }
- sms.SetMaxHealth(_config.SubmarinesoloMaxHealth);
- sms._health = _config.SubmarinesoloStartHealth;
- }
- #endregion
- #region Submarineduo
- void OnEntitySpawned(SubmarineDuo smd)
- {
- if (smd == null)
- {
- return;
- }
- smd.SetMaxHealth(_config.SubmarineduoMaxHealth);
- smd._health = _config.SubmarineduoStartHealth;
- }
- #endregion
- #region Snowmobile
- void OnEntitySpawned(Snowmobile sm)
- {
- if (sm == null)
- {
- return;
- }
- sm.SetMaxHealth(_config.SnowmobileMaxHealth);
- sm._health = _config.SnowmobileStartHealth;
- }
- #endregion
- // #region Tomahasnowmobile
- // void OnEntitySpawned(tomahaSnowmobile tsm)
- // {
- // if (tsm == null)
- // {
- // return;
- // }
- // tsm.SetMaxHealth(_config.TomahaSnowMobileMaxHealth);
- // tsm._health = _config.TomahaSnowMobileStartHealth;
- // }
- // #endregion
- #region Ch47
- void OnEntitySpawned(CH47Helicopter ch)
- {
- if (ch == null)
- {
- return;
- }
- ch.SetMaxHealth(_config.Ch47MaxHealth);
- ch._health = _config.Ch47StartHealth;
- }
- #endregion
- #endregion
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment