Skip to content

Commit

Permalink
Merge remote-tracking branch 'wizard/master' into upstream-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Rxup committed Sep 24, 2023
2 parents d0a19cc + d225bd3 commit e66f75a
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Content.Server/Nutrition/Components/FoodComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public sealed partial class FoodComponent : Component
[DataField]
public SoundSpecifier UseSound = new SoundPathSpecifier("/Audio/Items/eatfood.ogg");

[DataField]
[DataField("trash")]
public EntProtoId? TrashPrototype;

[DataField]
Expand Down
55 changes: 55 additions & 0 deletions Content.Server/StationEvents/BasicStationEventSchedulerSystem.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
using System.Linq;
using Content.Server.Administration;
using Content.Server.GameTicking.Rules;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.StationEvents.Components;
using Content.Shared.Administration;
using JetBrains.Annotations;
using Robust.Shared.Random;
using Robust.Shared.Toolshed;
using Robust.Shared.Utility;

namespace Content.Server.StationEvents
{
Expand Down Expand Up @@ -56,4 +61,54 @@ private void ResetTimer(BasicStationEventSchedulerComponent component)
component.TimeUntilNextEvent = _random.Next(300, 1500);
}
}

[ToolshedCommand, AdminCommand(AdminFlags.Debug)]
public sealed class StationEventCommand : ToolshedCommand
{
private EventManagerSystem? _stationEvent;

[CommandImplementation("lsprob")]
public IEnumerable<(string, float)> LsProb()
{
_stationEvent ??= GetSys<EventManagerSystem>();
var events = _stationEvent.AllEvents();

var totalWeight = events.Sum(x => x.Value.Weight);

foreach (var (proto, comp) in events)
{
yield return (proto.ID, comp.Weight / totalWeight);
}
}

[CommandImplementation("lsprobtime")]
public IEnumerable<(string, float)> LsProbTime([CommandArgument] float time)
{
_stationEvent ??= GetSys<EventManagerSystem>();
var events = _stationEvent.AllEvents().Where(pair => pair.Value.EarliestStart <= time).ToList();

var totalWeight = events.Sum(x => x.Value.Weight);

foreach (var (proto, comp) in events)
{
yield return (proto.ID, comp.Weight / totalWeight);
}
}

[CommandImplementation("prob")]
public float Prob([CommandArgument] string eventId)
{
_stationEvent ??= GetSys<EventManagerSystem>();
var events = _stationEvent.AllEvents();

var totalWeight = events.Sum(x => x.Value.Weight);
var weight = 0f;
if (events.TryFirstOrNull(p => p.Key.ID == eventId, out var pair))
{
weight = pair.Value.Value.Weight;
}

return weight / totalWeight;
}
}
}
2 changes: 1 addition & 1 deletion Content.Shared/Audio/AmbientSoundComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Content.Shared.Audio;
[Access(typeof(SharedAmbientSoundSystem))]
public sealed partial class AmbientSoundComponent : Component, IComponentTreeEntry<AmbientSoundComponent>
{
[DataField("enabled")]
[DataField("enabled", readOnly: true)]
[ViewVariables(VVAccess.ReadWrite)] // only for map editing
public bool Enabled { get; set; } = true;

Expand Down
10 changes: 5 additions & 5 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
Entries:
- author: graevy
changes:
- {message: Added reflection to the reflective vest and shuttle walls, type: Add}
id: 4381
time: '2023-07-31T01:07:46.0000000+00:00'
- author: Bhijn and Myr
changes:
- {message: 'The flash overlay is no longer offset towards the actual physical center
Expand Down Expand Up @@ -2981,3 +2976,8 @@ Entries:
- {message: Nukies can declare war again., type: Fix}
id: 4880
time: '2023-09-23T20:00:13.0000000+00:00'
- author: Doru991
changes:
- {message: Trash spawns correctly after food is eaten., type: Fix}
id: 4881
time: '2023-09-24T17:20:03.0000000+00:00'
6 changes: 6 additions & 0 deletions Resources/Locale/en-US/commands/toolshed-commands.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ command-description-stations-rename =
Renames the given station.
command-description-stations-largestgrid =
Returns the largest grid the given station has, if any.
command-description-stationevent-lsprob =
Lists the probability of different station events occuring out of the entire pool.
command-description-stationevent-lsprobtime =
Lists the probability of different station events occuring based on the specified length of a round.
command-description-stationevent-prob =
Returns the probability of a single station event occuring out of the entire pool.
command-description-admins-active =
Returns a list of active admins.
command-description-admins-all =
Expand Down
1 change: 0 additions & 1 deletion Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,6 @@
- Trash
- VimPilot
- Mouse
- DoorBumpOpener
- type: Respirator
damage:
types:
Expand Down
9 changes: 4 additions & 5 deletions Resources/Prototypes/Entities/Objects/Magic/books.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
components:
- type: Spellbook
spells:
FlashRune: -1
ActionSpawnMagicarpSpell: -1

- type: entity
Expand Down Expand Up @@ -99,7 +98,7 @@
- state: spell_default
- type: Spellbook
spells:
FlashRune: -1
ExplosionRune: -1
IgniteRune: -1
StunRune: -1
ActionFlashRune: -1
ActionExplosionRune: -1
ActionIgniteRune: -1
ActionStunRune: -1
4 changes: 2 additions & 2 deletions Resources/Prototypes/Hydroponics/seeds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,7 @@
Vitamin:
Min: 1
Max: 4
PotencyDivisor: 40
PotencyDivisor: 40

- type: seed
id: bungo
Expand Down Expand Up @@ -1301,4 +1301,4 @@
Enzyme:
Min: 5
Max: 10
PotencyDivisor: 20
PotencyDivisor: 20
8 changes: 7 additions & 1 deletion Tools/actions_changelog_rss.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
FEED_DESCRIPTION = "Changelog for the official Wizard's Den branch of Space Station 14."
FEED_LANGUAGE = "en-US"
FEED_GUID_PREFIX = "ss14-changelog-wizards-"
FEED_URL = "https://central.spacestation14.io/changelog.xml"

CHANGELOG_FILE = "Resources/Changelog/Changelog.yml"

Expand All @@ -56,7 +57,11 @@
XML_NS = "https://spacestation14.com/changelog_rss"
XML_NS_B = f"{{{XML_NS}}}"

XML_NS_ATOM = "http://www.w3.org/2005/Atom"
XML_NS_ATOM_B = f"{{{XML_NS_ATOM}}}"

ET.register_namespace("ss14", XML_NS)
ET.register_namespace("atom", XML_NS_ATOM)

# From https://stackoverflow.com/a/37958106/4678631
class NoDatesSafeLoader(yaml.SafeLoader):
Expand Down Expand Up @@ -113,6 +118,7 @@ def create_feed(changelog: Any, previous_items: List[ET.Element]) -> Tuple[ET.El
ET.SubElement(channel, "language").text = FEED_LANGUAGE

ET.SubElement(channel, "lastBuildDate").text = email.utils.format_datetime(time_now)
ET.SubElement(channel, XML_NS_ATOM_B + "link", {"type": "application/rss+xml", "rel": "self", "href": FEED_URL})

# Find the last item ID mentioned in the previous changelog
last_changelog_id = find_last_changelog_id(previous_items)
Expand All @@ -132,7 +138,7 @@ def create_new_item_since(changelog: Any, channel: ET.Element, since: int, now:
attrs = {XML_NS_B + "from-id": str(since), XML_NS_B + "to-id": str(top_entry_id)}
new_item = ET.SubElement(channel, "item", attrs)
ET.SubElement(new_item, "pubDate").text = email.utils.format_datetime(now)
ET.SubElement(new_item, "guid").text = f"{FEED_GUID_PREFIX}{since}-{top_entry_id}"
ET.SubElement(new_item, "guid", {"isPermaLink": "false"}).text = f"{FEED_GUID_PREFIX}{since}-{top_entry_id}"

ET.SubElement(new_item, "description").text = generate_description_for_entries(entries_for_item)

Expand Down

0 comments on commit e66f75a

Please sign in to comment.