Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Добавить АПИИ #30

Merged
merged 9 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public sealed partial class AdminVerbSystem
[ValidatePrototypeId<EntityPrototype>]
private const string DefaultThiefRule = "Thief";

// Corvax-Next-Api
FireNameFN marked this conversation as resolved.
Show resolved Hide resolved
[ValidatePrototypeId<EntityPrototype>]
private const string DefaultApiRule = "Api";

FireNameFN marked this conversation as resolved.
Show resolved Hide resolved
[ValidatePrototypeId<StartingGearPrototype>]
private const string PirateGearId = "PirateGear";

Expand Down Expand Up @@ -151,5 +155,20 @@ private void AddAntagVerbs(GetVerbsEvent<Verb> args)
Message = Loc.GetString("admin-verb-make-thief"),
};
args.Verbs.Add(thief);

// Corvax-Next-Api
FireNameFN marked this conversation as resolved.
Show resolved Hide resolved
Verb api = new()
{
Text = Loc.GetString("admin-verb-text-make-api"),
Category = VerbCategory.Antag,
Icon = new SpriteSpecifier.Rsi(new ResPath("/Textures/Mobs/Silicon/station_ai.rsi"), "ai"),
Act = () =>
{
_antag.ForceMakeAntag<ThiefRuleComponent>(targetPlayer, DefaultApiRule);
},
Impact = LogImpact.High,
Message = Loc.GetString("admin-verb-make-api"),
};
args.Verbs.Add(api);
FireNameFN marked this conversation as resolved.
Show resolved Hide resolved
}
}
20 changes: 17 additions & 3 deletions Content.Server/GameTicking/Rules/ThiefRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Content.Server.GameTicking.Rules.Components;
using Content.Server.Roles;
using Content.Shared.Humanoid;
using Content.Shared.Roles;

namespace Content.Server.GameTicking.Rules;

Expand All @@ -22,7 +23,7 @@ public override void Initialize()
private void AfterAntagSelected(Entity<ThiefRuleComponent> mindId, ref AfterAntagEntitySelectedEvent args)
{
var ent = args.EntityUid;
_antag.SendBriefing(ent, MakeBriefing(ent), null, null);
_antag.SendBriefing(ent, MakeBriefing(ent, args.Def.PrefRoles.Contains("Api")), null, null); // Corvax-Next-Api
}

// Character screen briefing
Expand All @@ -32,11 +33,24 @@ private void OnGetBriefing(Entity<ThiefRoleComponent> role, ref GetBriefingEvent

if (ent is null)
return;
args.Append(MakeBriefing(ent.Value));

// Corvax-Next-Api
FireNameFN marked this conversation as resolved.
Show resolved Hide resolved
var api = false;

foreach (var id in args.Mind.Comp.MindRoles)
if (TryComp<MindRoleComponent>(id, out var mindRole))
if (mindRole.AntagPrototype == "Api")
api = true;

args.Append(MakeBriefing(ent.Value, api));
}

private string MakeBriefing(EntityUid ent)
// Corvax-Next-Api
FireNameFN marked this conversation as resolved.
Show resolved Hide resolved
private string MakeBriefing(EntityUid ent, bool api)
{
if (api)
return Loc.GetString("api-role-greeting");

FireNameFN marked this conversation as resolved.
Show resolved Hide resolved
var isHuman = HasComp<HumanoidAppearanceComponent>(ent);
var briefing = isHuman
? Loc.GetString("thief-role-greeting-human")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public sealed partial class StealConditionComponent : Component
[DataField]
public bool CheckAlive = false;

// Corvax-Next-Api
[DataField]
public bool CheckHasAi = false;

/// <summary>
/// The minimum number of items you need to steal to fulfill a objective
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions Content.Server/Objectives/Systems/StealConditionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Content.Shared.Mobs.Components;
using Content.Shared.Movement.Pulling.Components;
using Content.Shared.Stacks;
using Content.Shared.Silicons.StationAi;

namespace Content.Server.Objectives.Systems;

Expand Down Expand Up @@ -196,6 +197,12 @@ private int CheckStealTarget(EntityUid entity, StealConditionComponent condition
}
}

// Corvax-Next-Api
FireNameFN marked this conversation as resolved.
Show resolved Hide resolved
if (condition.CheckHasAi)
if (TryComp<StationAiHolderComponent>(entity, out var holder))
if (holder.Slot.Item is null)
return 0;

FireNameFN marked this conversation as resolved.
Show resolved Hide resolved
return TryComp<StackComponent>(entity, out var stack) ? stack.Count : 1;
}
}
24 changes: 24 additions & 0 deletions Resources/Locale/ru-RU/_CorvaxNext/api.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
admin-verb-text-make-api = Сделать АПИИ
FireNameFN marked this conversation as resolved.
Show resolved Hide resolved
admin-verb-make-api = Сделать цель агентом похищения искусственного интеллекта.

api-backpack-category-utilities-name = Набор Утилит
api-backpack-category-utilities-description =
Набор полезных вещей, содержащий имплантер
хранилища, лазерный кинжал, а также
криптографический секвенсор.

ent-ToolboxApi = ящик воровских инструментов неопределённости
.desc = Здесь лежат ваши излюбленные воровские штучки. Осталось вспомнить, какие именно.

api-round-end-agent-name = агент похищения искусственного интеллекта

roles-antag-api-objective = Украдите станционный ИИ, действуя скрытно.

objective-condition-api-description = То, зачем я сюда прилетел. Осталось найти интелкарту и пробраться к нему.

steal-target-groups-ai = станционный ИИ, помещённый на интелкарту

api-role-greeting =
Вы агент похищения искусственного интеллекта, также известный как АПИИ.
У вас здесь одна цель: украсть станционный ИИ с помощью интелкарты.
Старайтесь действовать скрытно, вы это любите.
2 changes: 2 additions & 0 deletions Resources/Prototypes/Entities/Mobs/Player/silicon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@
unshaded:
Empty: { state: empty }
Occupied: { state: full }
- type: StealTarget # Corvax-Next-Api
stealGroup: Ai

- type: entity
id: PlayerStationAiEmpty
Expand Down
11 changes: 11 additions & 0 deletions Resources/Prototypes/_CorvaxNext/Catalog/api_toolbox_sets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- type: thiefBackpackSet
id: UtilitiesSet
name: api-backpack-category-utilities-name
description: api-backpack-category-utilities-description
sprite:
sprite: /Textures/Objects/Tools/Toolboxes/toolbox_syn.rsi
state: icon
content:
- StorageImplanter
- EnergyDaggerBox
- Emag
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
- type: entity
id: ToolboxApi
name: api undetermined toolbox
description: This is where your favorite api's supplies lie. Try to remember which ones.
parent: [ BaseItem, BaseMinorContraband ]
components:
- type: Sprite
sprite: Objects/Tools/Toolboxes/toolbox_thief.rsi
state: icon
- type: ThiefUndeterminedBackpack
maxSelectedSets: 3
possibleSets:
- CommunicatorSet
- ChameleonSet
- UtilitiesSet
- type: ActivatableUI
key: enum.ThiefBackpackUIKey.Key
- type: UserInterface
interfaces:
enum.ThiefBackpackUIKey.Key:
type: ThiefBackpackBoundUserInterface
25 changes: 25 additions & 0 deletions Resources/Prototypes/_CorvaxNext/GameRules/api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
- type: entity
parent: BaseGameRule
id: Api
components:
- type: ThiefRule
- type: AntagObjectives
objectives:
- EscapeThiefShuttleObjective
- AiStealObjective
- type: AntagSelection
agentName: api-round-end-agent-name
definitions:
- prefRoles: [ Api ]
max: 1
playerRatio: 15
lateJoinAdditional: true
allowNonHumans: true
multiAntagSetting: NotExclusive
startingGear: ApiGear
# components: # Corvax-MRP
# - type: Pacified
mindRoles:
- MindRoleApi
briefing:
sound: "/Audio/Misc/thief_greeting.ogg"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- type: stealTargetGroup
id: Ai
name: steal-target-groups-ai
sprite:
sprite: Mobs/Silicon/station_ai.rsi
state: ai
31 changes: 31 additions & 0 deletions Resources/Prototypes/_CorvaxNext/Objectives/api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
- type: entity
abstract: true
parent: BaseObjective
id: BaseApiObjective
components:
- type: Objective
issuer: objective-issuer-thief
- type: RoleRequirement
roles:
mindRoles:
- ThiefRole

- type: entity
abstract: true
parent: [BaseApiObjective, BaseStealObjective]
id: BaseApiStealObjective
components:
- type: StealCondition
verifyMapExistence: false
descriptionText: objective-condition-api-description
checkStealAreas: true

- type: entity
parent: BaseApiStealObjective
id: AiStealObjective
components:
- type: StealCondition
stealGroup: Ai
checkHasAi: true
- type: Objective
difficulty: 1
18 changes: 18 additions & 0 deletions Resources/Prototypes/_CorvaxNext/Roles/Antags/api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- type: antag
id: Api
name: roles-antag-thief-name
antagonist: true
setPreference: false
objective: roles-antag-api-objective
guides: [ Thieves ]
requirements:
- !type:OverallPlaytimeRequirement
time: 108000 # 30h # Corvax-RoleTime

- type: startingGear
id: ApiGear
storage:
back:
- ToolboxApi
- ClothingHandsChameleonThief
- ThiefBeacon
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Thief
- type: entity
parent: BaseMindRoleAntag
id: MindRoleApi
name: Api Role
# description: mind-role-api-description
components:
- type: MindRole
antagPrototype: Api
- type: ThiefRole
Loading