Prize limit for Arcades (#12855)

Fixes  #11477
This commit is contained in:
Jackrost
2023-01-15 03:52:06 +03:00
committed by GitHub
parent 2749d7231f
commit a047de01fe
10 changed files with 51 additions and 25 deletions

View File

@@ -63,6 +63,15 @@ namespace Content.Server.Arcade.Components
"HarmonicaInstrument", "OcarinaInstrument", "RecorderInstrument", "GunpetInstrument", "BirdToyInstrument"
};
[DataField("rewardMinAmount")]
public int _rewardMinAmount;
[DataField("rewardMaxAmount")]
public int _rewardMaxAmount;
[ViewVariables(VVAccess.ReadWrite)]
public int _rewardAmount = 0;
protected override void Initialize()
{
base.Initialize();
@@ -71,6 +80,10 @@ namespace Content.Server.Arcade.Components
{
UserInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
}
// Random amount of prizes
_rewardAmount = new Random().Next(_rewardMinAmount, _rewardMaxAmount + 1);
}
public void OnPowerStateChanged(PowerChangedEvent e)
@@ -115,8 +128,11 @@ namespace Content.Server.Arcade.Components
/// </summary>
public void ProcessWin()
{
var entityManager = IoCManager.Resolve<IEntityManager>();
entityManager.SpawnEntity(_random.Pick(_possibleRewards), entityManager.GetComponent<TransformComponent>(Owner).MapPosition);
if (_rewardAmount > 0)
{
_entityManager.SpawnEntity(_random.Pick(_possibleRewards), _entityManager.GetComponent<TransformComponent>(Owner).Coordinates);
_rewardAmount--;
}
}
/// <summary>

View File

@@ -58540,7 +58540,7 @@ entities:
parent: 60
type: Transform
- uid: 4611
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- rot: -1.5707963267948966 rad
pos: -11.5,-64.5
@@ -63374,7 +63374,7 @@ entities:
parent: 60
type: Transform
- uid: 5301
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- pos: -37.5,-34.5
parent: 60
@@ -135563,7 +135563,7 @@ entities:
parent: 60
type: Transform
- uid: 16123
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- rot: 1.5707963267948966 rad
pos: -10.5,-14.5

View File

@@ -44036,7 +44036,7 @@ entities:
parent: 8364
type: Transform
- uid: 6971
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- rot: -1.5707963267948966 rad
pos: 27.5,-1.5
@@ -51831,7 +51831,7 @@ entities:
parent: 8364
type: Transform
- uid: 8201
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- rot: -1.5707963267948966 rad
pos: 27.5,-2.5
@@ -102267,7 +102267,7 @@ entities:
parent: 8364
type: Transform
- uid: 11688
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- pos: 72.5,12.5
parent: 8364
@@ -201942,7 +201942,7 @@ entities:
parent: 8364
type: Transform
- uid: 25880
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- pos: 18.5,-10.5
parent: 8364
@@ -205408,7 +205408,7 @@ entities:
- powerLoad: 0
type: ApcPowerReceiver
- uid: 26426
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- pos: -4.5,45.5
parent: 8364

View File

@@ -58695,7 +58695,7 @@ entities:
parent: 127
type: Transform
- uid: 7176
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- pos: -32.5,-6.5
parent: 127
@@ -67374,7 +67374,7 @@ entities:
parent: 127
type: Transform
- uid: 8322
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- pos: -4.5,31.5
parent: 127

View File

@@ -68634,7 +68634,7 @@ entities:
parent: 30
type: Transform
- uid: 6451
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- pos: 18.5,44.5
parent: 30
@@ -128800,7 +128800,7 @@ entities:
parent: 30
type: Transform
- uid: 15237
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- pos: 37.5,45.5
parent: 30

View File

@@ -73609,7 +73609,7 @@ entities:
parent: 0
type: Transform
- uid: 6640
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- pos: -10.5,57.5
parent: 0
@@ -142270,7 +142270,7 @@ entities:
parent: 0
type: Transform
- uid: 16833
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- pos: -49.5,-23.5
parent: 0
@@ -180593,7 +180593,7 @@ entities:
parent: 0
type: Transform
- uid: 22605
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- pos: 0.5,-64.5
parent: 0
@@ -191615,13 +191615,13 @@ entities:
type: Transform
- type: ActiveEmergencyLight
- uid: 24288
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- pos: 23.5,0.5
parent: 0
type: Transform
- uid: 24289
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- pos: -61.5,-7.5
parent: 0
@@ -195947,14 +195947,14 @@ entities:
parent: 0
type: Transform
- uid: 24761
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- rot: -1.5707963267948966 rad
pos: 25.5,33.5
parent: 0
type: Transform
- uid: 24762
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- rot: -1.5707963267948966 rad
pos: 25.5,31.5

View File

@@ -14921,13 +14921,13 @@ entities:
- unspawnedCount: 35
type: BallisticAmmoProvider
- uid: 1652
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- pos: 10.5,-6.5
parent: 104
type: Transform
- uid: 1653
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- pos: 9.5,-6.5
parent: 104

View File

@@ -38616,7 +38616,7 @@ entities:
parent: 0
type: Transform
- uid: 3774
type: SpaceVillainArcade
type: SpaceVillainArcadeFilled
components:
- pos: -21.5,5.5
parent: 0

View File

@@ -11,5 +11,5 @@
- type: RandomSpawner
prototypes:
- BlockGameArcade
- SpaceVillainArcade
- SpaceVillainArcadeFilled
chance: 1

View File

@@ -41,6 +41,7 @@
parent: ArcadeBase
components:
- type: SpaceVillainArcade
rewardAmount: 0
- type: Wires
LayoutId: Arcade
BoardName: "Arcade"
@@ -56,6 +57,15 @@
- type: Computer
board: SpaceVillainArcadeComputerCircuitboard
- type: entity
id: SpaceVillainArcadeFilled
parent: SpaceVillainArcade
suffix: Filled
components:
- type: SpaceVillainArcade
rewardMinAmount: 5
rewardMaxAmount: 8
- type: entity
id: BlockGameArcade
description: An arcade cabinet with a strangely familiar game.