-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into ADTSlugCat
- Loading branch information
Showing
218 changed files
with
50,172 additions
and
46,978 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
Content.Server/ADT/DocumentPrinter/DocumentPrinterSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
using Content.Server.GameTicking; | ||
using Content.Shared.Containers.ItemSlots; | ||
using Content.Shared.Inventory; | ||
using Content.Shared.Paper; | ||
using Content.Shared.PDA; | ||
using Content.Shared.Verbs; | ||
using Robust.Shared.Audio.Systems; | ||
using Robust.Shared.Timing; | ||
|
||
namespace Content.Shared.DocumentPrinter; | ||
public sealed class DocumentPrinterSystem : EntitySystem | ||
{ | ||
const int TIME_YEAR_SPACE_STATION_ADT = 544; | ||
|
||
[Dependency] private readonly GameTicker _ticker = default!; | ||
[Dependency] private readonly IGameTiming _gameTiming = default!; | ||
[Dependency] private readonly SharedAudioSystem _audioSystem = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<DocumentPrinterComponent, PrintingDocumentEvent>(OnPrinting); | ||
SubscribeLocalEvent<DocumentPrinterComponent, GetVerbsEvent<AlternativeVerb>>(AddVerbOnOff); | ||
} | ||
|
||
public void AddVerbOnOff(EntityUid uid, DocumentPrinterComponent component, GetVerbsEvent<AlternativeVerb> args) | ||
{ | ||
AlternativeVerb verb = new(); | ||
if (component.IsOnAutocomplite) | ||
{ | ||
verb.Text = "Выкл."; | ||
verb.Act = () => | ||
{ | ||
component.IsOnAutocomplite = false; | ||
_audioSystem.PlayPvs(component.SwitchSound, uid); | ||
}; | ||
} | ||
else | ||
{ | ||
verb.Text = "Вкл."; | ||
verb.Act = () => | ||
{ | ||
component.IsOnAutocomplite = true; | ||
_audioSystem.PlayPvs(component.SwitchSound, uid); | ||
}; | ||
} | ||
args.Verbs.Add(verb); | ||
} | ||
|
||
public void OnPrinting(EntityUid uid, DocumentPrinterComponent component, PrintingDocumentEvent args) | ||
{ | ||
//coef for YEAR 544 | ||
if (!TryComp<PaperComponent>(args.Paper, out var paperComponent)) return; | ||
if (!TryComp<InventoryComponent>(args.Actor, out var inventoryComponent)) return; | ||
|
||
string text = paperComponent.Content; | ||
|
||
if (component.IsOnAutocomplite) | ||
{ | ||
MetaDataComponent? meta_id = null; | ||
PdaComponent? pda = null; | ||
foreach (var slot in inventoryComponent.Containers) | ||
{ | ||
if (slot.ID == "id")//for checking only PDA | ||
{ | ||
TryComp(slot.ContainedEntity, out pda); | ||
TryComp<ItemSlotsComponent>(slot.ContainedEntity, out var itemslots); | ||
if (itemslots is not null) | ||
TryComp(itemslots.Slots["PDA-id"].Item, out meta_id); | ||
break; | ||
} | ||
} | ||
DateTime time = DateTime.UtcNow.AddYears(TIME_YEAR_SPACE_STATION_ADT).AddHours(3); | ||
text = text.Replace("$time$", $"{_gameTiming.CurTime.Subtract(_ticker.RoundStartTimeSpan).ToString("hh\\:mm\\:ss")} | {(time.Day < 10 ? $"0{time.Day}" : time.Day)}.{(time.Month < 10 ? $"0{time.Month}" : time.Month)}.{time.Year}"); | ||
if (pda?.StationName is not null) | ||
{ | ||
text = text.Replace("Station XX-000", pda.StationName); | ||
} | ||
if (meta_id is null) | ||
{ | ||
text = text.Replace("$name$", ""); | ||
text = text.Replace("$job$", ""); | ||
} | ||
else | ||
{ | ||
int startIndex = meta_id.EntityName.IndexOf("("); int endIndex = meta_id.EntityName.IndexOf(")"); | ||
if (startIndex.Equals(-1) || startIndex.Equals(-1)) | ||
{ | ||
text = text.Replace("$name$", ""); | ||
text = text.Replace("$job$", ""); | ||
} | ||
else | ||
{ | ||
string id_card_word = "ID карта "; | ||
text = text.Replace("$name$", meta_id.EntityName.Replace(id_card_word, "").Substring(0, startIndex - id_card_word.Length - 2)); | ||
text = text.Replace("$job$", meta_id.EntityName.Substring(startIndex + 1, endIndex - startIndex - 1)); | ||
} | ||
} | ||
paperComponent.Content = text; | ||
// if (!TryComp<MetaDataComponent>(args.Actor, out var comp)) return; // was for test, STFU JUST LEAVE IT HERE | ||
} | ||
else | ||
{ | ||
text = text.Replace("$time$", ""); | ||
text = text.Replace("$name$", ""); | ||
text = text.Replace("$job$", ""); | ||
paperComponent.Content = text; | ||
} | ||
} | ||
} | ||
|
||
//(C) Korol_Charodey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
Content.Shared/ADT/DocumentPrinter/DocumentPrinterComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Content.Shared.Research.Prototypes; | ||
using Robust.Shared.Audio; | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Shared.DocumentPrinter; | ||
|
||
[RegisterComponent, NetworkedComponent] | ||
public sealed partial class DocumentPrinterComponent : Component | ||
{ | ||
public List<(EntityUid, LatheRecipePrototype)> Queue { get; set; } = new(); | ||
public SoundSpecifier SwitchSound = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg"); | ||
public bool IsOnAutocomplite = true; | ||
} | ||
|
||
public sealed class PrintingDocumentEvent : EntityEventArgs | ||
{ | ||
public EntityUid Paper { get; private set; } | ||
public EntityUid Actor { get; private set; } | ||
public PrintingDocumentEvent(EntityUid paper, EntityUid actor) | ||
{ | ||
Paper = paper; | ||
Actor = actor; | ||
} | ||
} | ||
//(C) Korol_Charodey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
Resources/Locale/ru-RU/ADT/prototypes/Catalog/Fills/Crates/food.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ent-ADTCrateFoodOktoberfestSnack = ящик закусок к пиву | ||
.desc = Ящик с набором колбасок и кренделей, чтобы закусывать пиво на Октоберфесте. Ну или в техах под карго. | ||
.suffix = { "Октоберфест" } |
3 changes: 3 additions & 0 deletions
3
Resources/Locale/ru-RU/ADT/prototypes/Catalog/Fills/Crates/fun.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ent-ADTCrateFunOktoberfestClothes = ящик одежды для Октоберфеста | ||
.desc = Ящик с набором мужской и женской традиционной одежды для Октоберфеста. | ||
.suffix = { "Октоберфест" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.