Fix RCS1077

This commit is contained in:
RoosterDragon
2023-03-18 12:47:08 +00:00
committed by Gustas
parent 499efa1d0a
commit 330ca92045
60 changed files with 110 additions and 97 deletions

View File

@@ -9,6 +9,7 @@
*/
#endregion
using System;
using System.Linq;
using Eluant;
using OpenRA.Mods.Common.Traits;
@@ -33,7 +34,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Returns the count of the actor's specified ammopool.")]
public int AmmoCount(string poolName = "primary")
{
var pool = ammoPools.FirstOrDefault(a => a.Info.Name == poolName);
var pool = Array.Find(ammoPools, a => a.Info.Name == poolName);
if (pool == null)
throw new LuaException($"Invalid ammopool name {poolName} queried on actor {self}.");
@@ -43,7 +44,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Returns the maximum count of ammo the actor can load.")]
public int MaximumAmmoCount(string poolName = "primary")
{
var pool = ammoPools.FirstOrDefault(a => a.Info.Name == poolName);
var pool = Array.Find(ammoPools, a => a.Info.Name == poolName);
if (pool == null)
throw new LuaException($"Invalid ammopool name {poolName} queried on actor {self}.");
@@ -54,7 +55,7 @@ namespace OpenRA.Mods.Common.Scripting
"(Use a negative amount to remove ammo.)")]
public void Reload(string poolName = "primary", int amount = 1)
{
var pool = ammoPools.FirstOrDefault(a => a.Info.Name == poolName);
var pool = Array.Find(ammoPools, a => a.Info.Name == poolName);
if (pool == null)
throw new LuaException($"Invalid ammopool name {poolName} queried on actor {self}.");