Skip to content

Commit

Permalink
Merge pull request #81 from borkroman/master
Browse files Browse the repository at this point in the history
Берегись, Синдикекс!!
  • Loading branch information
DTSpawn authored Nov 1, 2024
2 parents 08995c1 + 4d6ccd2 commit 54921d0
Show file tree
Hide file tree
Showing 36 changed files with 522 additions and 2 deletions.
48 changes: 48 additions & 0 deletions Content.Server/_Adventure/Abilities/BorgCuffedSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Content.Shared._Adventure.Abilities;
using Content.Shared.Actions;
using Content.Shared.Cuffs;
using Content.Shared.DoAfter;

namespace Content.Server._Adventure.Abilities;
public sealed class BorgCuffedSystem : EntitySystem
{
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedCuffableSystem _cuffable = default!;
[Dependency] private readonly SharedActionsSystem _actions = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<BorgCuffedComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<BorgCuffedComponent, BorgCuffedActionEvent>(OnCuffed);
SubscribeLocalEvent<BorgCuffedComponent, BorgCuffedDoAfterEvent>(OnCuffedDoAfter);
}

private void OnInit(EntityUid uid, BorgCuffedComponent component, ComponentInit args)
{
_actions.AddAction(uid, component.CuffActionId);
}

private void OnCuffed(EntityUid uid, BorgCuffedComponent component, BorgCuffedActionEvent args)
{
_doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager ,uid, component.CuffTime,
new BorgCuffedDoAfterEvent(), uid, target: args.Target, used: uid)
{
BreakOnMove = true,
BreakOnDamage = true
});

args.Handled = true;
}

private void OnCuffedDoAfter(EntityUid uid, BorgCuffedComponent component,
BorgCuffedDoAfterEvent args)
{
if (args.Handled || args.Cancelled || args.Args.Target == null)
return;

var cuffs = Spawn(component.CableCuffsId, Transform(uid).Coordinates);

if (!_cuffable.TryCuffingNow(args.Args.User, args.Args.Target.Value, cuffs))
QueueDel(cuffs);
}
}
9 changes: 9 additions & 0 deletions Content.Shared/Cuffs/Components/HandcuffComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ public record struct UncuffAttemptEvent(EntityUid User, EntityUid Target)
public bool Cancelled = false;
}

// Adventure-Start
[ByRefEvent]
public record struct CuffedEvent(EntityUid User, EntityUid Target)
{
public readonly EntityUid User = User;
public readonly EntityUid Target = Target;
}
// Adventure-End

/// <summary>
/// Event raised on an entity being uncuffed to determine any modifiers to the amount of time it takes to uncuff them.
/// </summary>
Expand Down
22 changes: 22 additions & 0 deletions Content.Shared/Cuffs/SharedCuffableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,30 @@ public bool TryAddNewCuffs(EntityUid target, EntityUid user, EntityUid handcuff,

_container.Insert(handcuff, component.Container);
UpdateHeldItems(target, handcuff, component);

// Adventure-Start
var ev = new CuffedEvent(user, target);
RaiseLocalEvent(target, ref ev);
// Adventure-End

return true;
}

// Adventure-Start
public bool TryCuffingNow(EntityUid user, EntityUid target, EntityUid handcuff,
HandcuffComponent? handcuffComponent = null, CuffableComponent? cuffable = null)
{
if (!Resolve(handcuff, ref handcuffComponent) || !Resolve(target, ref cuffable, false))
return false;

if (!TryAddNewCuffs(target, user, handcuff, cuffable))
return false;

handcuffComponent.Used = true;
_audio.PlayPvs(handcuffComponent.EndCuffSound, handcuff);
return true;
}
// Adventure-End

/// <returns>False if the target entity isn't cuffable.</returns>
public bool TryCuffing(EntityUid user, EntityUid target, EntityUid handcuff, HandcuffComponent? handcuffComponent = null, CuffableComponent? cuffable = null)
Expand Down
35 changes: 35 additions & 0 deletions Content.Shared/_Adventure/Abilities/BorgCuffedComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Content.Shared.Actions;
using Content.Shared.DoAfter;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Shared._Adventure.Abilities;

[RegisterComponent]
public sealed partial class BorgCuffedComponent : Component
{
[ViewVariables(VVAccess.ReadWrite),
DataField("cableCuffs", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string CableCuffsId = "Zipties";

[ViewVariables(VVAccess.ReadWrite),
DataField("cuffActionId", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string CuffActionId = "BorgCuffed";

[ViewVariables(VVAccess.ReadWrite),
DataField("cuffTime")]
public float CuffTime = 3.5f;
}


public sealed partial class BorgCuffedActionEvent : EntityTargetActionEvent
{

}

[Serializable, NetSerializable]
public sealed partial class BorgCuffedDoAfterEvent : SimpleDoAfterEvent
{

}
1 change: 1 addition & 0 deletions Resources/Locale/ru-RU/Adventure/Jobs/job.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ JobEngineerBorg = киборг-инженер
JobJanitorBorg = киборг-уборщик
JobMedicalBorg = киборг-доктор
JobServiceBorg = киборг-официант
JobSecurityBorg = киборг-охранник
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Adventure/Maps/adventure_avrite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@
JanitorBorg: [ 1, 1 ]
MedicalBorg: [ 1, 1 ]
ServiceBorg: [ 1, 1 ]
SecurityBorg: [ 1, 1 ]
3 changes: 2 additions & 1 deletion Resources/Prototypes/Adventure/Maps/adventure_bagel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,5 @@
EngineerBorg: [ 1, 1 ]
JanitorBorg: [ 1, 1 ]
MedicalBorg: [ 1, 1 ]
ServiceBorg: [ 1, 1 ]
ServiceBorg: [ 1, 1 ]
SecurityBorg: [ 1, 1 ]
1 change: 1 addition & 0 deletions Resources/Prototypes/Adventure/Maps/adventure_box.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,5 @@
JanitorBorg: [ 1, 1 ]
MedicalBorg: [ 1, 1 ]
ServiceBorg: [ 1, 1 ]
SecurityBorg: [ 1, 1 ]

1 change: 1 addition & 0 deletions Resources/Prototypes/Adventure/Maps/adventure_cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@
JanitorBorg: [ 1, 1 ]
MedicalBorg: [ 1, 1 ]
ServiceBorg: [ 1, 1 ]
SecurityBorg: [ 1, 1 ]
1 change: 1 addition & 0 deletions Resources/Prototypes/Adventure/Maps/adventure_delta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@
JanitorBorg: [ 1, 1 ]
MedicalBorg: [ 1, 1 ]
ServiceBorg: [ 1, 1 ]
SecurityBorg: [ 1, 1 ]
1 change: 1 addition & 0 deletions Resources/Prototypes/Adventure/Maps/adventure_maus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@
JanitorBorg: [ 1, 1 ]
MedicalBorg: [ 1, 1 ]
ServiceBorg: [ 1, 1 ]
SecurityBorg: [ 1, 1 ]
1 change: 1 addition & 0 deletions Resources/Prototypes/Adventure/Maps/starquest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
JanitorBorg: [ 1, 1 ]
MedicalBorg: [ 1, 1 ]
ServiceBorg: [ 1, 1 ]
SecurityBorg: [ 1, 1 ]
# XO: [ 1, 1 ]
# Foreman: [ 1, 1 ]
# HeadDoctor: [ 1, 1 ]
Expand Down
39 changes: 39 additions & 0 deletions Resources/Prototypes/Adventure/Roles/BorgDep/BorgRoles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,43 @@
icon: JobIconServiceBorg
supervisors: job-supervisors-rd
jobEntity: PlayerBorgService
applyTraits: false

#SecurityBorg
- type: jobIcon
parent: JobIcon
id: JobIconSecurityBorg
icon:
sprite: Adventure/Roles/BorgDep/BorgIcons.rsi
state: SecurityBorg
jobName: киборг-охранник

- type: playTimeTracker
id: JobSecurityBorg

- type: job
id: SecurityBorg
name: киборг-охранник
description: job-description-borg
playTimeTracker: JobSecurityBorg
requirements: # Ответственная роль, надо больше игрового времени охраны
- !type:RoleTimeRequirement
role: JobSecurityOfficer
time: 10800
- !type:RoleTimeRequirement
role: JobWarden
time: 10800
- !type:DepartmentTimeRequirement
department: Security
time: 10800
- !type:RoleTimeRequirement
role: JobBorg
time: 3600
- !type:DepartmentTimeRequirement
department: Science
time: 3600
canBeAntag: false
icon: JobIconSecurityBorg
supervisors: job-supervisors-rd
jobEntity: PlayerBorgChassisSecurity
applyTraits: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- type: entity
id: BorgCuffed
name: Заковать
description: Заковать нарушителя стяжками.
categories: [ HideSpawnMenu ]
components:
- type: EntityTargetAction
icon: { sprite: Adventure/Roles/BorgDep/SecBorg/modul.rsi, state: SecBorgCuff }
itemIconStyle: NoItem
whitelist:
components:
- Cuffable
canTargetSelf: false
useDelay: 15
checkCanAccess: true
range: 2
event: !type:BorgCuffedActionEvent
priority: 9
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
#Модуль Охраны
- type: Tag
id: SecModul

- type: entity
id: BaseModuleSec
parent: BaseBorgModule
abstract: true
components:
- type: Tag
tags:
- SecModul

- type: entity
id: ModuleSec
parent: [ BaseModuleSec, BaseProviderBorgModule ]
description: Всё для вас и вашей безопасности.
name: Охранный модуль киборга
components:
- type: BorgModuleIcon
icon: { sprite: Adventure/Roles/BorgDep/SecBorg/modul.rsi, state: Sec-module }
- type: Sprite
sprite: Adventure/Roles/BorgDep/SecBorg/modul.rsi
layers:
- state: SecModul
- state: SecModul-icon
- type: ItemBorgModule
items:
- FlashSecBorg
- StunbatonSecBorg
- WeaponLaserSecBorg

#Усмиритель
- type: entity
name: Усмиритель MK-2
noSpawn: false
parent: BaseWeaponBatterySmall
id: WeaponLaserSecBorg
description: Для особо буйных.
components:
- type: Sprite
sprite: Adventure/Roles/BorgDep/SecBorg/Borg_laser_gun.rsi
layers:
- state: base
map: ["enum.GunVisualLayers.Base"]
- state: mag-unshaded-4
map: ["enum.GunVisualLayers.MagUnshaded"]
shader: unshaded
- type: Gun
selectedMode: SemiAuto
fireRate: 3
soundGunshot:
path: /Audio/Weapons/Guns/Gunshots/taser2.ogg
- type: ProjectileBatteryAmmoProvider
proto: BulletDisabler
fireCost: 100
- type: BatteryWeaponFireModes
fireModes:
- proto: BulletDisabler
fireCost: 100
- proto: BorgLethalBullet
fireCost: 100
- type: BatterySelfRecharger
autoRecharge: true
autoRechargeRate: 20
- type: MagazineVisuals
magState: mag
steps: 5
zeroVisible: false

- type: entity
id: BorgLethalBullet
noSpawn: true
name: летальный заряд
parent: BaseBullet
components:
- type: Projectile
damage:
types:
Heat: 12
ignoreWhitelist:
tags:
- Swarmer
- type: Sprite
sprite: Adventure/Roles/BorgDep/SecBorg/Borg_laser_gun.rsi
layers:
- state: OmniLetal
shader: unshaded
- type: PointLight
enabled: true
color: "#ff4052"
radius: 1.5
energy: 2

#Дубинка-шокер киборга
- type: entity
name: дубинка-шокер киборга
parent: Stunbaton
id: StunbatonSecBorg
description: Электрошоковая дубинка для выведения людей из строя.
noSpawn: false
components:
- type: BatterySelfRecharger
autoRecharge: true
autoRechargeRate: 10

#Вспышка киборга
- type: entity
name: вспышка киборга
parent: Flash
id: FlashSecBorg
description: Сверхяркая вспышка со спусковым механизмом.
noSpawn: false
components:
- type: Sprite
sprite: Objects/Weapons/Melee/flash.rsi
layers:
- state: burnt
map: [ "enum.FlashVisuals.BaseLayer" ]
- state: flashing
map: [ "enum.FlashVisuals.LightLayer" ]
visible: false
shader: unshaded
- type: LimitedCharges
maxCharges: 10
charges: 10
- type: AutoRecharge
rechargeDuration: 30



Loading

0 comments on commit 54921d0

Please sign in to comment.