When using the NoDeploy flag on zones players are able to duplicate deployable items in their hot bar.
NoDeploy flag issue.
Error in KillEntityAndReturnItem method
In most cases, only one object can be "deploy". But the function takes all amount in hot bar.
Before
private void KillEntityAndReturnItem(BasePlayer player, BaseEntity entity, Item item)
{
ItemDefinition itemDefinition = item == null ? null : item.info;
int amount = item.amount;
ulong skin = item == null ? 0UL : item.skin;
entity.Invoke(() =>
{
if (entity && !entity.IsDestroyed)
entity.Kill(BaseNetworkable.DestroyMode.Gib);
if (itemDefinition != null)
player.GiveItem(ItemManager.Create(itemDefinition, amount, skin));
}, 0.1f);
}After
private void KillEntityAndReturnItem(BasePlayer player, BaseEntity entity, Item item)
{
ItemDefinition itemDefinition = item == null ? null : item.info;
ulong skin = item == null ? 0UL : item.skin;
entity.Invoke(() =>
{
if (entity && !entity.IsDestroyed)
entity.Kill(BaseNetworkable.DestroyMode.Gib);
if (itemDefinition != null)
player.GiveItem(ItemManager.Create(itemDefinition, 1, skin));
}, 0.1f);
}