Remove redundant admin flag check in AdminVerbSystem.Tools (#36122)
* Remove redundant admin flag check * Formatting
This commit is contained in:
@@ -65,343 +65,340 @@ public sealed partial class AdminVerbSystem
|
|||||||
if (!_adminManager.HasAdminFlag(player, AdminFlags.Admin))
|
if (!_adminManager.HasAdminFlag(player, AdminFlags.Admin))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_adminManager.HasAdminFlag(player, AdminFlags.Admin))
|
if (TryComp<DoorBoltComponent>(args.Target, out var bolts))
|
||||||
{
|
{
|
||||||
if (TryComp<DoorBoltComponent>(args.Target, out var bolts))
|
Verb bolt = new()
|
||||||
{
|
{
|
||||||
Verb bolt = new()
|
Text = bolts.BoltsDown ? "Unbolt" : "Bolt",
|
||||||
{
|
|
||||||
Text = bolts.BoltsDown ? "Unbolt" : "Bolt",
|
|
||||||
Category = VerbCategory.Tricks,
|
|
||||||
Icon = bolts.BoltsDown
|
|
||||||
? new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/unbolt.png"))
|
|
||||||
: new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/bolt.png")),
|
|
||||||
Act = () =>
|
|
||||||
{
|
|
||||||
_door.SetBoltsDown((args.Target, bolts), !bolts.BoltsDown);
|
|
||||||
},
|
|
||||||
Impact = LogImpact.Medium,
|
|
||||||
Message = Loc.GetString(bolts.BoltsDown
|
|
||||||
? "admin-trick-unbolt-description"
|
|
||||||
: "admin-trick-bolt-description"),
|
|
||||||
Priority = (int) (bolts.BoltsDown ? TricksVerbPriorities.Unbolt : TricksVerbPriorities.Bolt),
|
|
||||||
};
|
|
||||||
args.Verbs.Add(bolt);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TryComp<AirlockComponent>(args.Target, out var airlockComp))
|
|
||||||
{
|
|
||||||
Verb emergencyAccess = new()
|
|
||||||
{
|
|
||||||
Text = airlockComp.EmergencyAccess ? "Emergency Access Off" : "Emergency Access On",
|
|
||||||
Category = VerbCategory.Tricks,
|
|
||||||
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/emergency_access.png")),
|
|
||||||
Act = () =>
|
|
||||||
{
|
|
||||||
_airlockSystem.SetEmergencyAccess((args.Target, airlockComp), !airlockComp.EmergencyAccess);
|
|
||||||
},
|
|
||||||
Impact = LogImpact.Medium,
|
|
||||||
Message = Loc.GetString(airlockComp.EmergencyAccess
|
|
||||||
? "admin-trick-emergency-access-off-description"
|
|
||||||
: "admin-trick-emergency-access-on-description"),
|
|
||||||
Priority = (int) (airlockComp.EmergencyAccess ? TricksVerbPriorities.EmergencyAccessOff : TricksVerbPriorities.EmergencyAccessOn),
|
|
||||||
};
|
|
||||||
args.Verbs.Add(emergencyAccess);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HasComp<DamageableComponent>(args.Target))
|
|
||||||
{
|
|
||||||
Verb rejuvenate = new()
|
|
||||||
{
|
|
||||||
Text = "Rejuvenate",
|
|
||||||
Category = VerbCategory.Tricks,
|
|
||||||
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/rejuvenate.png")),
|
|
||||||
Act = () =>
|
|
||||||
{
|
|
||||||
_rejuvenate.PerformRejuvenate(args.Target);
|
|
||||||
},
|
|
||||||
Impact = LogImpact.Extreme,
|
|
||||||
Message = Loc.GetString("admin-trick-rejuvenate-description"),
|
|
||||||
Priority = (int) TricksVerbPriorities.Rejuvenate,
|
|
||||||
};
|
|
||||||
args.Verbs.Add(rejuvenate);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!HasComp<GodmodeComponent>(args.Target))
|
|
||||||
{
|
|
||||||
Verb makeIndestructible = new()
|
|
||||||
{
|
|
||||||
Text = "Make Indestructible",
|
|
||||||
Category = VerbCategory.Tricks,
|
|
||||||
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/plus.svg.192dpi.png")),
|
|
||||||
Act = () =>
|
|
||||||
{
|
|
||||||
_sharedGodmodeSystem.EnableGodmode(args.Target);
|
|
||||||
},
|
|
||||||
Impact = LogImpact.Extreme,
|
|
||||||
Message = Loc.GetString("admin-trick-make-indestructible-description"),
|
|
||||||
Priority = (int) TricksVerbPriorities.MakeIndestructible,
|
|
||||||
};
|
|
||||||
args.Verbs.Add(makeIndestructible);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Verb makeVulnerable = new()
|
|
||||||
{
|
|
||||||
Text = "Make Vulnerable",
|
|
||||||
Category = VerbCategory.Tricks,
|
|
||||||
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/plus.svg.192dpi.png")),
|
|
||||||
Act = () =>
|
|
||||||
{
|
|
||||||
_sharedGodmodeSystem.DisableGodmode(args.Target);
|
|
||||||
},
|
|
||||||
Impact = LogImpact.Extreme,
|
|
||||||
Message = Loc.GetString("admin-trick-make-vulnerable-description"),
|
|
||||||
Priority = (int) TricksVerbPriorities.MakeVulnerable,
|
|
||||||
};
|
|
||||||
args.Verbs.Add(makeVulnerable);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TryComp<BatteryComponent>(args.Target, out var battery))
|
|
||||||
{
|
|
||||||
Verb refillBattery = new()
|
|
||||||
{
|
|
||||||
Text = "Refill Battery",
|
|
||||||
Category = VerbCategory.Tricks,
|
|
||||||
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/fill_battery.png")),
|
|
||||||
Act = () =>
|
|
||||||
{
|
|
||||||
_batterySystem.SetCharge(args.Target, battery.MaxCharge, battery);
|
|
||||||
},
|
|
||||||
Impact = LogImpact.Medium,
|
|
||||||
Message = Loc.GetString("admin-trick-refill-battery-description"),
|
|
||||||
Priority = (int) TricksVerbPriorities.RefillBattery,
|
|
||||||
};
|
|
||||||
args.Verbs.Add(refillBattery);
|
|
||||||
|
|
||||||
Verb drainBattery = new()
|
|
||||||
{
|
|
||||||
Text = "Drain Battery",
|
|
||||||
Category = VerbCategory.Tricks,
|
|
||||||
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/drain_battery.png")),
|
|
||||||
Act = () =>
|
|
||||||
{
|
|
||||||
_batterySystem.SetCharge(args.Target, 0, battery);
|
|
||||||
},
|
|
||||||
Impact = LogImpact.Medium,
|
|
||||||
Message = Loc.GetString("admin-trick-drain-battery-description"),
|
|
||||||
Priority = (int) TricksVerbPriorities.DrainBattery,
|
|
||||||
};
|
|
||||||
args.Verbs.Add(drainBattery);
|
|
||||||
|
|
||||||
Verb infiniteBattery = new()
|
|
||||||
{
|
|
||||||
Text = "Infinite Battery",
|
|
||||||
Category = VerbCategory.Tricks,
|
|
||||||
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/infinite_battery.png")),
|
|
||||||
Act = () =>
|
|
||||||
{
|
|
||||||
var recharger = EnsureComp<BatterySelfRechargerComponent>(args.Target);
|
|
||||||
recharger.AutoRecharge = true;
|
|
||||||
recharger.AutoRechargeRate = battery.MaxCharge; // Instant refill.
|
|
||||||
recharger.AutoRechargePause = false; // No delay.
|
|
||||||
},
|
|
||||||
Impact = LogImpact.Medium,
|
|
||||||
Message = Loc.GetString("admin-trick-infinite-battery-object-description"),
|
|
||||||
Priority = (int) TricksVerbPriorities.InfiniteBattery,
|
|
||||||
};
|
|
||||||
args.Verbs.Add(infiniteBattery);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TryComp<AnchorableComponent>(args.Target, out var anchor))
|
|
||||||
{
|
|
||||||
Verb blockUnanchor = new()
|
|
||||||
{
|
|
||||||
Text = "Block Unanchoring",
|
|
||||||
Category = VerbCategory.Tricks,
|
|
||||||
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/anchor.svg.192dpi.png")),
|
|
||||||
Act = () =>
|
|
||||||
{
|
|
||||||
RemComp(args.Target, anchor);
|
|
||||||
},
|
|
||||||
Impact = LogImpact.Medium,
|
|
||||||
Message = Loc.GetString("admin-trick-block-unanchoring-description"),
|
|
||||||
Priority = (int) TricksVerbPriorities.BlockUnanchoring,
|
|
||||||
};
|
|
||||||
args.Verbs.Add(blockUnanchor);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TryComp<GasTankComponent>(args.Target, out var tank))
|
|
||||||
{
|
|
||||||
Verb refillInternalsO2 = new()
|
|
||||||
{
|
|
||||||
Text = "Refill Internals Oxygen",
|
|
||||||
Category = VerbCategory.Tricks,
|
|
||||||
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/oxygen.rsi"), "icon"),
|
|
||||||
Act = () =>
|
|
||||||
{
|
|
||||||
RefillGasTank(args.Target, Gas.Oxygen, tank);
|
|
||||||
},
|
|
||||||
Impact = LogImpact.Extreme,
|
|
||||||
Message = Loc.GetString("admin-trick-internals-refill-oxygen-description"),
|
|
||||||
Priority = (int) TricksVerbPriorities.RefillOxygen,
|
|
||||||
};
|
|
||||||
args.Verbs.Add(refillInternalsO2);
|
|
||||||
|
|
||||||
Verb refillInternalsN2 = new()
|
|
||||||
{
|
|
||||||
Text = "Refill Internals Nitrogen",
|
|
||||||
Category = VerbCategory.Tricks,
|
|
||||||
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/red.rsi"), "icon"),
|
|
||||||
Act = () =>
|
|
||||||
{
|
|
||||||
RefillGasTank(args.Target, Gas.Nitrogen, tank);
|
|
||||||
},
|
|
||||||
Impact = LogImpact.Extreme,
|
|
||||||
Message = Loc.GetString("admin-trick-internals-refill-nitrogen-description"),
|
|
||||||
Priority = (int) TricksVerbPriorities.RefillNitrogen,
|
|
||||||
};
|
|
||||||
args.Verbs.Add(refillInternalsN2);
|
|
||||||
|
|
||||||
Verb refillInternalsPlasma = new()
|
|
||||||
{
|
|
||||||
Text = "Refill Internals Plasma",
|
|
||||||
Category = VerbCategory.Tricks,
|
|
||||||
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/plasma.rsi"), "icon"),
|
|
||||||
Act = () =>
|
|
||||||
{
|
|
||||||
RefillGasTank(args.Target, Gas.Plasma, tank);
|
|
||||||
},
|
|
||||||
Impact = LogImpact.Extreme,
|
|
||||||
Message = Loc.GetString("admin-trick-internals-refill-plasma-description"),
|
|
||||||
Priority = (int) TricksVerbPriorities.RefillPlasma,
|
|
||||||
};
|
|
||||||
args.Verbs.Add(refillInternalsPlasma);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HasComp<InventoryComponent>(args.Target))
|
|
||||||
{
|
|
||||||
Verb refillInternalsO2 = new()
|
|
||||||
{
|
|
||||||
Text = "Refill Internals Oxygen",
|
|
||||||
Category = VerbCategory.Tricks,
|
|
||||||
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/oxygen.rsi"), "icon"),
|
|
||||||
Act = () => RefillEquippedTanks(args.User, Gas.Oxygen),
|
|
||||||
Impact = LogImpact.Extreme,
|
|
||||||
Message = Loc.GetString("admin-trick-internals-refill-oxygen-description"),
|
|
||||||
Priority = (int) TricksVerbPriorities.RefillOxygen,
|
|
||||||
};
|
|
||||||
args.Verbs.Add(refillInternalsO2);
|
|
||||||
|
|
||||||
Verb refillInternalsN2 = new()
|
|
||||||
{
|
|
||||||
Text = "Refill Internals Nitrogen",
|
|
||||||
Category = VerbCategory.Tricks,
|
|
||||||
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/red.rsi"), "icon"),
|
|
||||||
Act = () =>RefillEquippedTanks(args.User, Gas.Nitrogen),
|
|
||||||
Impact = LogImpact.Extreme,
|
|
||||||
Message = Loc.GetString("admin-trick-internals-refill-nitrogen-description"),
|
|
||||||
Priority = (int) TricksVerbPriorities.RefillNitrogen,
|
|
||||||
};
|
|
||||||
args.Verbs.Add(refillInternalsN2);
|
|
||||||
|
|
||||||
Verb refillInternalsPlasma = new()
|
|
||||||
{
|
|
||||||
Text = "Refill Internals Plasma",
|
|
||||||
Category = VerbCategory.Tricks,
|
|
||||||
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/plasma.rsi"), "icon"),
|
|
||||||
Act = () => RefillEquippedTanks(args.User, Gas.Plasma),
|
|
||||||
Impact = LogImpact.Extreme,
|
|
||||||
Message = Loc.GetString("admin-trick-internals-refill-plasma-description"),
|
|
||||||
Priority = (int) TricksVerbPriorities.RefillPlasma,
|
|
||||||
};
|
|
||||||
args.Verbs.Add(refillInternalsPlasma);
|
|
||||||
}
|
|
||||||
|
|
||||||
Verb sendToTestArena = new()
|
|
||||||
{
|
|
||||||
Text = "Send to test arena",
|
|
||||||
Category = VerbCategory.Tricks,
|
Category = VerbCategory.Tricks,
|
||||||
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/eject.svg.192dpi.png")),
|
Icon = bolts.BoltsDown
|
||||||
|
? new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/unbolt.png"))
|
||||||
|
: new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/bolt.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
var (mapUid, gridUid) = _adminTestArenaSystem.AssertArenaLoaded(player);
|
_door.SetBoltsDown((args.Target, bolts), !bolts.BoltsDown);
|
||||||
_transformSystem.SetCoordinates(args.Target, new EntityCoordinates(gridUid ?? mapUid, Vector2.One));
|
|
||||||
},
|
},
|
||||||
Impact = LogImpact.Medium,
|
Impact = LogImpact.Medium,
|
||||||
Message = Loc.GetString("admin-trick-send-to-test-arena-description"),
|
Message = Loc.GetString(bolts.BoltsDown
|
||||||
Priority = (int) TricksVerbPriorities.SendToTestArena,
|
? "admin-trick-unbolt-description"
|
||||||
|
: "admin-trick-bolt-description"),
|
||||||
|
Priority = (int)(bolts.BoltsDown ? TricksVerbPriorities.Unbolt : TricksVerbPriorities.Bolt),
|
||||||
};
|
};
|
||||||
args.Verbs.Add(sendToTestArena);
|
args.Verbs.Add(bolt);
|
||||||
|
}
|
||||||
|
|
||||||
var activeId = FindActiveId(args.Target);
|
if (TryComp<AirlockComponent>(args.Target, out var airlockComp))
|
||||||
|
{
|
||||||
if (activeId is not null)
|
Verb emergencyAccess = new()
|
||||||
{
|
{
|
||||||
Verb grantAllAccess = new()
|
Text = airlockComp.EmergencyAccess ? "Emergency Access Off" : "Emergency Access On",
|
||||||
|
Category = VerbCategory.Tricks,
|
||||||
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/emergency_access.png")),
|
||||||
|
Act = () =>
|
||||||
{
|
{
|
||||||
Text = "Grant All Access",
|
_airlockSystem.SetEmergencyAccess((args.Target, airlockComp), !airlockComp.EmergencyAccess);
|
||||||
Category = VerbCategory.Tricks,
|
},
|
||||||
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Misc/id_cards.rsi"), "centcom"),
|
Impact = LogImpact.Medium,
|
||||||
Act = () =>
|
Message = Loc.GetString(airlockComp.EmergencyAccess
|
||||||
{
|
? "admin-trick-emergency-access-off-description"
|
||||||
GiveAllAccess(activeId.Value);
|
: "admin-trick-emergency-access-on-description"),
|
||||||
},
|
Priority = (int)(airlockComp.EmergencyAccess ? TricksVerbPriorities.EmergencyAccessOff : TricksVerbPriorities.EmergencyAccessOn),
|
||||||
Impact = LogImpact.Extreme,
|
};
|
||||||
Message = Loc.GetString("admin-trick-grant-all-access-description"),
|
args.Verbs.Add(emergencyAccess);
|
||||||
Priority = (int) TricksVerbPriorities.GrantAllAccess,
|
}
|
||||||
};
|
|
||||||
args.Verbs.Add(grantAllAccess);
|
|
||||||
|
|
||||||
Verb revokeAllAccess = new()
|
if (HasComp<DamageableComponent>(args.Target))
|
||||||
{
|
{
|
||||||
Text = "Revoke All Access",
|
Verb rejuvenate = new()
|
||||||
Category = VerbCategory.Tricks,
|
|
||||||
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Misc/id_cards.rsi"), "default"),
|
|
||||||
Act = () =>
|
|
||||||
{
|
|
||||||
RevokeAllAccess(activeId.Value);
|
|
||||||
},
|
|
||||||
Impact = LogImpact.Extreme,
|
|
||||||
Message = Loc.GetString("admin-trick-revoke-all-access-description"),
|
|
||||||
Priority = (int) TricksVerbPriorities.RevokeAllAccess,
|
|
||||||
};
|
|
||||||
args.Verbs.Add(revokeAllAccess);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HasComp<AccessComponent>(args.Target))
|
|
||||||
{
|
{
|
||||||
Verb grantAllAccess = new()
|
Text = "Rejuvenate",
|
||||||
|
Category = VerbCategory.Tricks,
|
||||||
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/rejuvenate.png")),
|
||||||
|
Act = () =>
|
||||||
{
|
{
|
||||||
Text = "Grant All Access",
|
_rejuvenate.PerformRejuvenate(args.Target);
|
||||||
Category = VerbCategory.Tricks,
|
},
|
||||||
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Misc/id_cards.rsi"), "centcom"),
|
Impact = LogImpact.Extreme,
|
||||||
Act = () =>
|
Message = Loc.GetString("admin-trick-rejuvenate-description"),
|
||||||
{
|
Priority = (int)TricksVerbPriorities.Rejuvenate,
|
||||||
GiveAllAccess(args.Target);
|
};
|
||||||
},
|
args.Verbs.Add(rejuvenate);
|
||||||
Impact = LogImpact.Extreme,
|
}
|
||||||
Message = Loc.GetString("admin-trick-grant-all-access-description"),
|
|
||||||
Priority = (int) TricksVerbPriorities.GrantAllAccess,
|
|
||||||
};
|
|
||||||
args.Verbs.Add(grantAllAccess);
|
|
||||||
|
|
||||||
Verb revokeAllAccess = new()
|
if (!HasComp<GodmodeComponent>(args.Target))
|
||||||
|
{
|
||||||
|
Verb makeIndestructible = new()
|
||||||
|
{
|
||||||
|
Text = "Make Indestructible",
|
||||||
|
Category = VerbCategory.Tricks,
|
||||||
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/plus.svg.192dpi.png")),
|
||||||
|
Act = () =>
|
||||||
{
|
{
|
||||||
Text = "Revoke All Access",
|
_sharedGodmodeSystem.EnableGodmode(args.Target);
|
||||||
Category = VerbCategory.Tricks,
|
},
|
||||||
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Misc/id_cards.rsi"), "default"),
|
Impact = LogImpact.Extreme,
|
||||||
Act = () =>
|
Message = Loc.GetString("admin-trick-make-indestructible-description"),
|
||||||
{
|
Priority = (int)TricksVerbPriorities.MakeIndestructible,
|
||||||
RevokeAllAccess(args.Target);
|
};
|
||||||
},
|
args.Verbs.Add(makeIndestructible);
|
||||||
Impact = LogImpact.Extreme,
|
}
|
||||||
Message = Loc.GetString("admin-trick-revoke-all-access-description"),
|
else
|
||||||
Priority = (int) TricksVerbPriorities.RevokeAllAccess,
|
{
|
||||||
};
|
Verb makeVulnerable = new()
|
||||||
args.Verbs.Add(revokeAllAccess);
|
{
|
||||||
}
|
Text = "Make Vulnerable",
|
||||||
|
Category = VerbCategory.Tricks,
|
||||||
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/plus.svg.192dpi.png")),
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
_sharedGodmodeSystem.DisableGodmode(args.Target);
|
||||||
|
},
|
||||||
|
Impact = LogImpact.Extreme,
|
||||||
|
Message = Loc.GetString("admin-trick-make-vulnerable-description"),
|
||||||
|
Priority = (int)TricksVerbPriorities.MakeVulnerable,
|
||||||
|
};
|
||||||
|
args.Verbs.Add(makeVulnerable);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TryComp<BatteryComponent>(args.Target, out var battery))
|
||||||
|
{
|
||||||
|
Verb refillBattery = new()
|
||||||
|
{
|
||||||
|
Text = "Refill Battery",
|
||||||
|
Category = VerbCategory.Tricks,
|
||||||
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/fill_battery.png")),
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
_batterySystem.SetCharge(args.Target, battery.MaxCharge, battery);
|
||||||
|
},
|
||||||
|
Impact = LogImpact.Medium,
|
||||||
|
Message = Loc.GetString("admin-trick-refill-battery-description"),
|
||||||
|
Priority = (int)TricksVerbPriorities.RefillBattery,
|
||||||
|
};
|
||||||
|
args.Verbs.Add(refillBattery);
|
||||||
|
|
||||||
|
Verb drainBattery = new()
|
||||||
|
{
|
||||||
|
Text = "Drain Battery",
|
||||||
|
Category = VerbCategory.Tricks,
|
||||||
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/drain_battery.png")),
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
_batterySystem.SetCharge(args.Target, 0, battery);
|
||||||
|
},
|
||||||
|
Impact = LogImpact.Medium,
|
||||||
|
Message = Loc.GetString("admin-trick-drain-battery-description"),
|
||||||
|
Priority = (int)TricksVerbPriorities.DrainBattery,
|
||||||
|
};
|
||||||
|
args.Verbs.Add(drainBattery);
|
||||||
|
|
||||||
|
Verb infiniteBattery = new()
|
||||||
|
{
|
||||||
|
Text = "Infinite Battery",
|
||||||
|
Category = VerbCategory.Tricks,
|
||||||
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/infinite_battery.png")),
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
var recharger = EnsureComp<BatterySelfRechargerComponent>(args.Target);
|
||||||
|
recharger.AutoRecharge = true;
|
||||||
|
recharger.AutoRechargeRate = battery.MaxCharge; // Instant refill.
|
||||||
|
recharger.AutoRechargePause = false; // No delay.
|
||||||
|
},
|
||||||
|
Impact = LogImpact.Medium,
|
||||||
|
Message = Loc.GetString("admin-trick-infinite-battery-object-description"),
|
||||||
|
Priority = (int)TricksVerbPriorities.InfiniteBattery,
|
||||||
|
};
|
||||||
|
args.Verbs.Add(infiniteBattery);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TryComp<AnchorableComponent>(args.Target, out var anchor))
|
||||||
|
{
|
||||||
|
Verb blockUnanchor = new()
|
||||||
|
{
|
||||||
|
Text = "Block Unanchoring",
|
||||||
|
Category = VerbCategory.Tricks,
|
||||||
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/anchor.svg.192dpi.png")),
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
RemComp(args.Target, anchor);
|
||||||
|
},
|
||||||
|
Impact = LogImpact.Medium,
|
||||||
|
Message = Loc.GetString("admin-trick-block-unanchoring-description"),
|
||||||
|
Priority = (int)TricksVerbPriorities.BlockUnanchoring,
|
||||||
|
};
|
||||||
|
args.Verbs.Add(blockUnanchor);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TryComp<GasTankComponent>(args.Target, out var tank))
|
||||||
|
{
|
||||||
|
Verb refillInternalsO2 = new()
|
||||||
|
{
|
||||||
|
Text = "Refill Internals Oxygen",
|
||||||
|
Category = VerbCategory.Tricks,
|
||||||
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/oxygen.rsi"), "icon"),
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
RefillGasTank(args.Target, Gas.Oxygen, tank);
|
||||||
|
},
|
||||||
|
Impact = LogImpact.Extreme,
|
||||||
|
Message = Loc.GetString("admin-trick-internals-refill-oxygen-description"),
|
||||||
|
Priority = (int)TricksVerbPriorities.RefillOxygen,
|
||||||
|
};
|
||||||
|
args.Verbs.Add(refillInternalsO2);
|
||||||
|
|
||||||
|
Verb refillInternalsN2 = new()
|
||||||
|
{
|
||||||
|
Text = "Refill Internals Nitrogen",
|
||||||
|
Category = VerbCategory.Tricks,
|
||||||
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/red.rsi"), "icon"),
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
RefillGasTank(args.Target, Gas.Nitrogen, tank);
|
||||||
|
},
|
||||||
|
Impact = LogImpact.Extreme,
|
||||||
|
Message = Loc.GetString("admin-trick-internals-refill-nitrogen-description"),
|
||||||
|
Priority = (int)TricksVerbPriorities.RefillNitrogen,
|
||||||
|
};
|
||||||
|
args.Verbs.Add(refillInternalsN2);
|
||||||
|
|
||||||
|
Verb refillInternalsPlasma = new()
|
||||||
|
{
|
||||||
|
Text = "Refill Internals Plasma",
|
||||||
|
Category = VerbCategory.Tricks,
|
||||||
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/plasma.rsi"), "icon"),
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
RefillGasTank(args.Target, Gas.Plasma, tank);
|
||||||
|
},
|
||||||
|
Impact = LogImpact.Extreme,
|
||||||
|
Message = Loc.GetString("admin-trick-internals-refill-plasma-description"),
|
||||||
|
Priority = (int)TricksVerbPriorities.RefillPlasma,
|
||||||
|
};
|
||||||
|
args.Verbs.Add(refillInternalsPlasma);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (HasComp<InventoryComponent>(args.Target))
|
||||||
|
{
|
||||||
|
Verb refillInternalsO2 = new()
|
||||||
|
{
|
||||||
|
Text = "Refill Internals Oxygen",
|
||||||
|
Category = VerbCategory.Tricks,
|
||||||
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/oxygen.rsi"), "icon"),
|
||||||
|
Act = () => RefillEquippedTanks(args.User, Gas.Oxygen),
|
||||||
|
Impact = LogImpact.Extreme,
|
||||||
|
Message = Loc.GetString("admin-trick-internals-refill-oxygen-description"),
|
||||||
|
Priority = (int)TricksVerbPriorities.RefillOxygen,
|
||||||
|
};
|
||||||
|
args.Verbs.Add(refillInternalsO2);
|
||||||
|
|
||||||
|
Verb refillInternalsN2 = new()
|
||||||
|
{
|
||||||
|
Text = "Refill Internals Nitrogen",
|
||||||
|
Category = VerbCategory.Tricks,
|
||||||
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/red.rsi"), "icon"),
|
||||||
|
Act = () => RefillEquippedTanks(args.User, Gas.Nitrogen),
|
||||||
|
Impact = LogImpact.Extreme,
|
||||||
|
Message = Loc.GetString("admin-trick-internals-refill-nitrogen-description"),
|
||||||
|
Priority = (int)TricksVerbPriorities.RefillNitrogen,
|
||||||
|
};
|
||||||
|
args.Verbs.Add(refillInternalsN2);
|
||||||
|
|
||||||
|
Verb refillInternalsPlasma = new()
|
||||||
|
{
|
||||||
|
Text = "Refill Internals Plasma",
|
||||||
|
Category = VerbCategory.Tricks,
|
||||||
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/plasma.rsi"), "icon"),
|
||||||
|
Act = () => RefillEquippedTanks(args.User, Gas.Plasma),
|
||||||
|
Impact = LogImpact.Extreme,
|
||||||
|
Message = Loc.GetString("admin-trick-internals-refill-plasma-description"),
|
||||||
|
Priority = (int)TricksVerbPriorities.RefillPlasma,
|
||||||
|
};
|
||||||
|
args.Verbs.Add(refillInternalsPlasma);
|
||||||
|
}
|
||||||
|
|
||||||
|
Verb sendToTestArena = new()
|
||||||
|
{
|
||||||
|
Text = "Send to test arena",
|
||||||
|
Category = VerbCategory.Tricks,
|
||||||
|
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/eject.svg.192dpi.png")),
|
||||||
|
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
var (mapUid, gridUid) = _adminTestArenaSystem.AssertArenaLoaded(player);
|
||||||
|
_transformSystem.SetCoordinates(args.Target, new EntityCoordinates(gridUid ?? mapUid, Vector2.One));
|
||||||
|
},
|
||||||
|
Impact = LogImpact.Medium,
|
||||||
|
Message = Loc.GetString("admin-trick-send-to-test-arena-description"),
|
||||||
|
Priority = (int)TricksVerbPriorities.SendToTestArena,
|
||||||
|
};
|
||||||
|
args.Verbs.Add(sendToTestArena);
|
||||||
|
|
||||||
|
var activeId = FindActiveId(args.Target);
|
||||||
|
|
||||||
|
if (activeId is not null)
|
||||||
|
{
|
||||||
|
Verb grantAllAccess = new()
|
||||||
|
{
|
||||||
|
Text = "Grant All Access",
|
||||||
|
Category = VerbCategory.Tricks,
|
||||||
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Misc/id_cards.rsi"), "centcom"),
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
GiveAllAccess(activeId.Value);
|
||||||
|
},
|
||||||
|
Impact = LogImpact.Extreme,
|
||||||
|
Message = Loc.GetString("admin-trick-grant-all-access-description"),
|
||||||
|
Priority = (int)TricksVerbPriorities.GrantAllAccess,
|
||||||
|
};
|
||||||
|
args.Verbs.Add(grantAllAccess);
|
||||||
|
|
||||||
|
Verb revokeAllAccess = new()
|
||||||
|
{
|
||||||
|
Text = "Revoke All Access",
|
||||||
|
Category = VerbCategory.Tricks,
|
||||||
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Misc/id_cards.rsi"), "default"),
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
RevokeAllAccess(activeId.Value);
|
||||||
|
},
|
||||||
|
Impact = LogImpact.Extreme,
|
||||||
|
Message = Loc.GetString("admin-trick-revoke-all-access-description"),
|
||||||
|
Priority = (int)TricksVerbPriorities.RevokeAllAccess,
|
||||||
|
};
|
||||||
|
args.Verbs.Add(revokeAllAccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (HasComp<AccessComponent>(args.Target))
|
||||||
|
{
|
||||||
|
Verb grantAllAccess = new()
|
||||||
|
{
|
||||||
|
Text = "Grant All Access",
|
||||||
|
Category = VerbCategory.Tricks,
|
||||||
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Misc/id_cards.rsi"), "centcom"),
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
GiveAllAccess(args.Target);
|
||||||
|
},
|
||||||
|
Impact = LogImpact.Extreme,
|
||||||
|
Message = Loc.GetString("admin-trick-grant-all-access-description"),
|
||||||
|
Priority = (int)TricksVerbPriorities.GrantAllAccess,
|
||||||
|
};
|
||||||
|
args.Verbs.Add(grantAllAccess);
|
||||||
|
|
||||||
|
Verb revokeAllAccess = new()
|
||||||
|
{
|
||||||
|
Text = "Revoke All Access",
|
||||||
|
Category = VerbCategory.Tricks,
|
||||||
|
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Misc/id_cards.rsi"), "default"),
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
RevokeAllAccess(args.Target);
|
||||||
|
},
|
||||||
|
Impact = LogImpact.Extreme,
|
||||||
|
Message = Loc.GetString("admin-trick-revoke-all-access-description"),
|
||||||
|
Priority = (int)TricksVerbPriorities.RevokeAllAccess,
|
||||||
|
};
|
||||||
|
args.Verbs.Add(revokeAllAccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TryComp<StackComponent>(args.Target, out var stack))
|
if (TryComp<StackComponent>(args.Target, out var stack))
|
||||||
|
|||||||
Reference in New Issue
Block a user