Skip to content

Commit

Permalink
Merge branch 'new-frontiers-14:master' into STC-Radio
Browse files Browse the repository at this point in the history
  • Loading branch information
dvir001 authored Nov 4, 2023
2 parents 3aed9e1 + a6899f0 commit 02329ad
Show file tree
Hide file tree
Showing 11 changed files with 265 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ protected override void Open()
var vendingMachineSys = entMan.System<VendingMachineSystem>();

if (entMan.TryGetComponent<MarketModifierComponent>(Owner, out var market))
{
_mod = market.Mod;
}

_cachedInventory = vendingMachineSys.GetAllInventory(Owner);

Expand All @@ -61,9 +59,8 @@ protected override void UpdateState(BoundUserInterfaceState state)
var priceMod = 1f;

if (entMan.TryGetComponent<MarketModifierComponent>(Owner, out var market))
{
priceMod = market.Mod;
}

_cachedInventory = newState.Inventory;
_menu?.UpdateBalance(newState.Balance);
_menu?.Populate(_cachedInventory, priceMod, out _cachedFilteredIndex, _menu.SearchBar.Text);
Expand Down
44 changes: 18 additions & 26 deletions Content.Server/VendingMachines/VendingMachineSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ private void OnBoundUIOpened(EntityUid uid, VendingMachineComponent component, B
var balance = 0;

if (TryComp<BankAccountComponent>(player, out var bank))
{
balance = bank.Balance;
}

UpdateVendingMachineInterfaceState(uid, component, balance);
}
Expand Down Expand Up @@ -321,14 +319,10 @@ public bool TryEjectVendorItem(EntityUid uid, InventoryType type, string itemId,
public void AuthorizedVend(EntityUid uid, EntityUid sender, InventoryType type, string itemId, VendingMachineComponent component)
{
if (!TryComp<BankAccountComponent>(sender, out var bank))
{
return;
}

if (!_prototypeManager.TryIndex<EntityPrototype>(itemId, out var proto))
{
return;
}

var price = _pricing.GetEstimatedPrice(proto);
// Somewhere deep in the code of pricing, a hardcoded 20 dollar value exists for anything without
Expand All @@ -337,14 +331,10 @@ public void AuthorizedVend(EntityUid uid, EntityUid sender, InventoryType type,
// this will undoubtably lead to vending machine exploits if I cant find wtf pricing system is doing.
// also stacks, food, solutions, are handled poorly too f
if (price == 0)
{
price = 20;
}

if (TryComp<MarketModifierComponent>(component.Owner, out var modifier))
{
price *= modifier.Mod;
}

var totalPrice = ((int) price);

Expand Down Expand Up @@ -422,26 +412,28 @@ public void EjectRandom(EntityUid uid, bool throwItem, bool forceEject = false,
if (availableItems.Count <= 0)
return;

if (!vendComponent.Ejecting)
return;

if (vendComponent.EjectRandomMax > vendComponent.EjectRandomCounter)
return;

var item = _random.Pick(availableItems);

if (!vendComponent.Ejecting)
if (forceEject)
{
if (vendComponent.EjectRandomMax > vendComponent.EjectRandomCounter)
{
if (forceEject)
{
vendComponent.NextItemToEject = item.ID;
vendComponent.ThrowNextItem = throwItem;
var entry = GetEntry(uid, item.ID, item.Type, vendComponent);
if (entry != null)
entry.Amount--;
EjectItem(uid, vendComponent, forceEject);
}
else
TryEjectVendorItem(uid, item.Type, item.ID, throwItem, 0, vendComponent);
vendComponent.EjectRandomCounter += 1;
}
vendComponent.NextItemToEject = item.ID;
vendComponent.ThrowNextItem = throwItem;
var entry = GetEntry(uid, item.ID, item.Type, vendComponent);
if (entry != null)
entry.Amount--;
EjectItem(uid, vendComponent, forceEject);
}
else
TryEjectVendorItem(uid, item.Type, item.ID, throwItem, 0, vendComponent);
vendComponent.EjectRandomCounter += 1;


}

private void EjectItem(EntityUid uid, VendingMachineComponent? vendComponent = null, bool forceEject = false)
Expand Down
32 changes: 15 additions & 17 deletions Content.Shared/RCD/Systems/RCDSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ private void OnDoAfter(EntityUid uid, RCDComponent comp, RCDDoAfterEvent args)
var gridUid = mapGrid.Owner;
var ev = new FloorTileAttemptEvent();

if (HasComp<ProtectedGridComponent>(gridUid) || ev.Cancelled) // Frontier - Remove all RCD use on outpost.
return;

switch (comp.Mode)
{
//Floor mode just needs the tile to be a space tile (subFloor)
Expand All @@ -179,19 +182,16 @@ private void OnDoAfter(EntityUid uid, RCDComponent comp, RCDDoAfterEvent args)
break;
//We don't want to place a space tile on something that's already a space tile. Let's do the inverse of the last check.
case RcdMode.Deconstruct:
if (!(HasComp<ProtectedGridComponent>(gridUid) || ev.Cancelled))
if (!IsTileBlocked(tile)) // Delete the turf
{
if (!IsTileBlocked(tile)) // Delete the turf
{
mapGrid.SetTile(snapPos, Tile.Empty);
_adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to set grid: {tile.GridUid} tile: {snapPos} to space");
}
else // Delete the targeted thing
{
var target = args.Target!.Value;
_adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to delete {ToPrettyString(target):target}");
QueueDel(target);
}
mapGrid.SetTile(snapPos, Tile.Empty);
_adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to set grid: {tile.GridUid} tile: {snapPos} to space");
}
else // Delete the targeted thing
{
var target = args.Target!.Value;
_adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to delete {ToPrettyString(target):target}");
QueueDel(target);
}
break;
//Walls are a special behaviour, and require us to build a new object with a transform rather than setting a grid tile,
Expand Down Expand Up @@ -219,11 +219,9 @@ private void OnDoAfter(EntityUid uid, RCDComponent comp, RCDDoAfterEvent args)
return; //I don't know why this would happen, but sure I guess. Get out of here invalid state!
}

if (!(HasComp<ProtectedGridComponent>(gridUid) || ev.Cancelled))
{
_audio.PlayPredicted(comp.SuccessSound, uid, user);
_charges.UseCharge(uid);
}
_audio.PlayPredicted(comp.SuccessSound, uid, user);
_charges.UseCharge(uid);

args.Handled = true;
}

Expand Down
20 changes: 20 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1639,3 +1639,23 @@ Entries:
message: Added the Gallery, an admin-only spawned grid for special events
id: 4595
time: '2023-11-02T23:40:45.0000000+00:00'
- author: dvir01
changes:
- type: Fix
message: Parts crates contain parts now, no more lies!
id: 4596
time: '2023-11-04T21:14:44.0000000+00:00'
- author: dvir01
changes:
- type: Tweak
message: 'NT Added "BRB" signs and desk bells to the SR vend machine, '
id: 4597
time: '2023-11-04T21:16:51.0000000+00:00'
- author: Cheackraze
changes:
- type: Tweak
message: >-
Changed the Empress's console to not be so huge, in order to combat
server lag
id: 4598
time: '2023-11-04T22:08:36.0000000+00:00'
2 changes: 1 addition & 1 deletion Resources/Maps/Shuttles/empress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7863,7 +7863,7 @@ entities:
entities:
- uid: 948
components:
- desc: Used to pilot a the security ship carrier, the empress.
- desc: Used to pilot the security ship carrier, the empress.
name: security shuttle console
type: MetaData
- pos: 14.5,-10.5
Expand Down
179 changes: 161 additions & 18 deletions Resources/Prototypes/Catalog/Fills/Crates/salvage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -345,33 +345,176 @@
id: CratePartsT3
name: tier 3 parts crate
description: Contains 5 random tier 3 parts for upgrading machines.
# TODO add contents.
#components:
#- type: StorageFill
# contents:
# - id: SalvagePartsT3Spawner
# amount: 5
components: # Frontier - Fixed the crates spawn in the most stupid way, but its fully working as it need to.
- type: StorageFill
contents:
- id: SuperCapacitorStockPart
orGroup: Part1
- id: PicoManipulatorStockPart
orGroup: Part1
- id: SuperMatterBinStockPart
orGroup: Part1
- id: SuperCapacitorStockPart
orGroup: Part2
- id: PicoManipulatorStockPart
orGroup: Part2
- id: SuperMatterBinStockPart
orGroup: Part2
- id: SuperCapacitorStockPart
orGroup: Part3
- id: PicoManipulatorStockPart
orGroup: Part3
- id: SuperMatterBinStockPart
orGroup: Part3
- id: SuperCapacitorStockPart
orGroup: Part4
- id: PicoManipulatorStockPart
orGroup: Part4
- id: SuperMatterBinStockPart
orGroup: Part4
- id: SuperCapacitorStockPart
orGroup: Part5
- id: PicoManipulatorStockPart
orGroup: Part5
- id: SuperMatterBinStockPart
orGroup: Part5

- type: entity
parent: CrateGenericSteel
id: CratePartsT3T4
name: tier 3/4 parts crate
description: Contains 5 random tier 3 or 4 parts for upgrading machines.
# TODO add contents.
#components:
# type: StorageFill
# contents:
# - id: SalvagePartsT3T4Spawner
# amount: 5
components: # Frontier - Fixed the crates spawn in the most stupid way, but its fully working as it need to.
- type: StorageFill
contents:
#tier 3
- id: SuperCapacitorStockPart
orGroup: Part1
prob: 0.2
- id: PicoManipulatorStockPart
orGroup: Part1
prob: 0.2
- id: SuperMatterBinStockPart
orGroup: Part1
prob: 0.2
- id: SuperCapacitorStockPart
orGroup: Part2
prob: 0.2
- id: PicoManipulatorStockPart
orGroup: Part2
prob: 0.2
- id: SuperMatterBinStockPart
orGroup: Part2
prob: 0.2
- id: SuperCapacitorStockPart
orGroup: Part3
prob: 0.2
- id: PicoManipulatorStockPart
orGroup: Part3
prob: 0.2
- id: SuperMatterBinStockPart
orGroup: Part3
prob: 0.2
- id: SuperCapacitorStockPart
orGroup: Part4
prob: 0.2
- id: PicoManipulatorStockPart
orGroup: Part4
prob: 0.2
- id: SuperMatterBinStockPart
orGroup: Part4
prob: 0.2
- id: SuperCapacitorStockPart
orGroup: Part5
prob: 0.2
- id: PicoManipulatorStockPart
orGroup: Part5
prob: 0.2
- id: SuperMatterBinStockPart
orGroup: Part5
prob: 0.2
#tier 4
- id: QuadraticCapacitorStockPart
orGroup: Part1
prob: 0.1
- id: FemtoManipulatorStockPart
orGroup: Part1
prob: 0.1
- id: BluespaceMatterBinStockPart
orGroup: Part1
prob: 0.1
- id: QuadraticCapacitorStockPart
orGroup: Part2
prob: 0.1
- id: FemtoManipulatorStockPart
orGroup: Part2
prob: 0.1
- id: BluespaceMatterBinStockPart
orGroup: Part2
prob: 0.1
- id: QuadraticCapacitorStockPart
orGroup: Part3
prob: 0.1
- id: FemtoManipulatorStockPart
orGroup: Part3
prob: 0.1
- id: BluespaceMatterBinStockPart
orGroup: Part3
prob: 0.1
- id: QuadraticCapacitorStockPart
orGroup: Part4
prob: 0.1
- id: FemtoManipulatorStockPart
orGroup: Part4
prob: 0.1
- id: BluespaceMatterBinStockPart
orGroup: Part4
prob: 0.1
- id: QuadraticCapacitorStockPart
orGroup: Part5
prob: 0.1
- id: FemtoManipulatorStockPart
orGroup: Part5
prob: 0.1
- id: BluespaceMatterBinStockPart
orGroup: Part5
prob: 0.1

- type: entity
parent: CrateGenericSteel
id: CratePartsT4
name: tier 4 parts crate
description: Contains 5 random tier 4 parts for upgrading machines.
# TODO add contents.
#components:
#- type: StorageFill
# contents:
# - id: SalvagePartsT4Spawner
# amount: 5
components: # Frontier - Fixed the crates spawn in the most stupid way, but its fully working as it need to.
- type: StorageFill
contents:
- id: QuadraticCapacitorStockPart
orGroup: Part1
- id: FemtoManipulatorStockPart
orGroup: Part1
- id: BluespaceMatterBinStockPart
orGroup: Part1
- id: QuadraticCapacitorStockPart
orGroup: Part2
- id: FemtoManipulatorStockPart
orGroup: Part2
- id: BluespaceMatterBinStockPart
orGroup: Part2
- id: QuadraticCapacitorStockPart
orGroup: Part3
- id: FemtoManipulatorStockPart
orGroup: Part3
- id: BluespaceMatterBinStockPart
orGroup: Part3
- id: QuadraticCapacitorStockPart
orGroup: Part4
- id: FemtoManipulatorStockPart
orGroup: Part4
- id: BluespaceMatterBinStockPart
orGroup: Part4
- id: QuadraticCapacitorStockPart
orGroup: Part5
- id: FemtoManipulatorStockPart
orGroup: Part5
- id: BluespaceMatterBinStockPart
orGroup: Part5
Loading

0 comments on commit 02329ad

Please sign in to comment.