Skip to content

Commit

Permalink
Added a new vehicle special godmode option to force-fix a vehicle whe…
Browse files Browse the repository at this point in the history
…n it gets damaged.

Required permission: `vMenu.VehicleOptions.SpecialGod`
  • Loading branch information
TomGrobbe committed May 3, 2018
1 parent 339c823 commit 50b7a91
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions PERMISSIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
|`vMenu.VehicleOptions.Menu`|Grants access to the Vehicle Options Menu.|Allowed|
|`vMenu.VehicleOptions.All`|Grants access to **ALL** `Vehicle Options Menu` options.|Denied|
|`vMenu.VehicleOptions.God`|Allows you to enable vehicle godmode.|Allowed|
|`vMenu.VehicleOptions.SpecialGod`|Allows you to enable a special vehicle godmode which repairs your vehicle instantly when it gets damaged, this is required for vehicles like the Phantom Wedge to keep them from slowly losing health even with regular god mode turned on.|Allowed|
|`vMenu.VehicleOptions.Repair`|Allows you to repair your vehicle.|Allowed|
|`vMenu.VehicleOptions.Wash`|Allows you to wash/clean your vehicle & set a custom dirt level.|Allowed|
|`vMenu.VehicleOptions.Engine`|Allows you to toggle your engine on/off.|Allowed|
Expand Down
5 changes: 5 additions & 0 deletions vMenu/FunctionsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,11 @@ private async Task VehicleOptions()
{
vd.CanBeBroken = !god;
}
bool specialgod = MainMenu.VehicleOptionsMenu.VehicleSpecialGodMode && cf.IsAllowed(Permission.VOSpecialGod);
if (specialgod && vehicle.Health != vehicle.MaxHealth)
{
vehicle.Repair(); // repair vehicle if special god mode is on and the vehicle is not full health.
}

// Freeze Vehicle Position (if enabled).
if (MainMenu.VehicleOptionsMenu.VehicleFrozen && cf.IsAllowed(Permission.VOFreeze))
Expand Down
1 change: 1 addition & 0 deletions vMenu/PermissionsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public enum Permission
VOMenu,
VOAll,
VOGod,
VOSpecialGod,
VORepair,
VOWash,
VOEngine,
Expand Down
11 changes: 11 additions & 0 deletions vMenu/menus/VehicleOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class VehicleOptions

// Public variables (getters only), return the private variables.
public bool VehicleGodMode { get; private set; } = UserDefaults.VehicleGodMode;
public bool VehicleSpecialGodMode { get; private set; } = UserDefaults.VehicleSpecialGodMode;
public bool VehicleEngineAlwaysOn { get; private set; } = UserDefaults.VehicleEngineAlwaysOn;
public bool VehicleNoSiren { get; private set; } = UserDefaults.VehicleNoSiren;
public bool VehicleNoBikeHelemet { get; private set; } = UserDefaults.VehicleNoBikeHelmet;
Expand Down Expand Up @@ -60,6 +61,8 @@ private void CreateMenu()
#region menu variables
// Create Checkboxes.
UIMenuCheckboxItem vehicleGod = new UIMenuCheckboxItem("Vehicle God Mode", VehicleGodMode, "Your vehicle will not be able to take visual or physical damage.");
UIMenuCheckboxItem vehicleSpecialGod = new UIMenuCheckboxItem("Special Vehicle God Mode", VehicleSpecialGodMode, "This option repairs your vehicle immediately when " +
"it gets damaged. This special god mode is needed for vehicles like the Phantom Wedge to keep it from breaking down with regular god mode turned on.");
UIMenuCheckboxItem vehicleEngineAO = new UIMenuCheckboxItem("Engine Always On", VehicleEngineAlwaysOn, "Keeps your vehicle engine on when you exit your vehicle.");
UIMenuCheckboxItem vehicleNoSiren = new UIMenuCheckboxItem("Disable Siren", VehicleNoSiren, "Disables your vehicle's siren. Only works if your vehicle actually has a siren.");
UIMenuCheckboxItem vehicleNoBikeHelmet = new UIMenuCheckboxItem("No Bike Helmet", VehicleNoBikeHelemet, "No longer auto-equip a helmet when getting on a bike or quad.");
Expand Down Expand Up @@ -198,6 +201,10 @@ private void CreateMenu()
{
menu.AddItem(vehicleGod);
}
if (cf.IsAllowed(Permission.VOSpecialGod)) // special god mode
{
menu.AddItem(vehicleSpecialGod);
}
if (cf.IsAllowed(Permission.VORepair)) // REPAIR VEHICLE
{
menu.AddItem(fixVehicle);
Expand Down Expand Up @@ -423,6 +430,10 @@ private void CreateMenu()
{
VehicleGodMode = _checked;
}
else if (item == vehicleSpecialGod) // special god mode
{
VehicleSpecialGodMode = _checked;
}
else if (item == vehicleFreeze) // Freeze Vehicle Toggled
{
VehicleFrozen = _checked;
Expand Down
1 change: 1 addition & 0 deletions vMenuServer/MainServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public class MainServer : BaseScript
"VOMenu",
"VOAll",
"VOGod",
"VOSpecialGod",
"VORepair",
"VOWash",
"VOEngine",
Expand Down
1 change: 1 addition & 0 deletions vMenuServer/config/permissions.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ add_ace builtin.everyone "vMenu.PlayerOptions.All" allow
add_ace builtin.everyone "vMenu.VehicleOptions.Menu" allow
add_ace builtin.everyone "vMenu.VehicleOptions.All" allow
#add_ace builtin.everyone "vMenu.VehicleOptions.God" allow
#add_ace builtin.everyone "vMenu.VehicleOptions.SpecialGod" allow
#add_ace builtin.everyone "vMenu.VehicleOptions.Repair" allow
#add_ace builtin.everyone "vMenu.VehicleOptions.Wash" allow
#add_ace builtin.everyone "vMenu.VehicleOptions.Engine" allow
Expand Down

0 comments on commit 50b7a91

Please sign in to comment.