From: ScarKy0 <106310278+ScarKy0@users.noreply.github.com> Date: Wed, 7 Jan 2026 05:51:44 +0000 (+0100) Subject: Chameleon Projector Battery, Price Decrease (#42271) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=590dc948ee87b1c1229235342cfe9bea2378aa2f;p=space-station-14.git Chameleon Projector Battery, Price Decrease (#42271) * init * fuck using * glowup * unused * meta * whuh * review * tests * Update SharedChameleonProjectorSystem.cs --- diff --git a/Content.Client/Power/Visualizers/PowerDeviceVisuals.cs b/Content.Client/Power/Visualizers/PowerDeviceVisuals.cs index 5cc86d203d..057dabae5d 100644 --- a/Content.Client/Power/Visualizers/PowerDeviceVisuals.cs +++ b/Content.Client/Power/Visualizers/PowerDeviceVisuals.cs @@ -3,5 +3,6 @@ namespace Content.Client.Power; /// Remains in use by portable scrubbers and lathes. public enum PowerDeviceVisualLayers : byte { - Powered + Powered, + Charging } diff --git a/Content.Shared/Polymorph/Systems/SharedChameleonProjectorSystem.cs b/Content.Shared/Polymorph/Systems/SharedChameleonProjectorSystem.cs index 6c686ff555..bf6fea5b47 100644 --- a/Content.Shared/Polymorph/Systems/SharedChameleonProjectorSystem.cs +++ b/Content.Shared/Polymorph/Systems/SharedChameleonProjectorSystem.cs @@ -14,6 +14,8 @@ using Robust.Shared.Prototypes; using Robust.Shared.Serialization.Manager; using System.Diagnostics.CodeAnalysis; using Content.Shared.Damage.Systems; +using Content.Shared.Item.ItemToggle; +using Content.Shared.Item.ItemToggle.Components; namespace Content.Shared.Polymorph.Systems; @@ -34,6 +36,7 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem [Dependency] private readonly SharedContainerSystem _container = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; [Dependency] private readonly SharedTransformSystem _xform = default!; + [Dependency] private readonly ItemToggleSystem _toggle = default!; public override void Initialize() { @@ -53,6 +56,7 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem SubscribeLocalEvent(OnDeselected); SubscribeLocalEvent(OnUnequipped); SubscribeLocalEvent(OnProjectorShutdown); + SubscribeLocalEvent(OnProjectorToggled); } #region Disguise entity @@ -105,6 +109,18 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem TryDisguise(ent, args.User, target); } + private void OnProjectorToggled(Entity ent, ref ItemToggledEvent args) + { + if (args.Activated) + return; + + if (ent.Comp.Disguised == null) + return; + + // We don't toggle here as this is only called when we subscribe to being toggled off. + TryReveal(ent.Comp.Disguised.Value); + } + private void OnGetVerbs(Entity ent, ref GetVerbsEvent args) { if (!args.CanAccess) @@ -136,6 +152,10 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem return false; } + // We do a TryComp, so if the item has variations without ItemToggle, they can still be used just fine. + if (TryComp(ent.Owner, out var itemToggle) && !_toggle.TryActivate((ent.Owner, itemToggle), user)) + return false; + _popup.PopupClient(Loc.GetString("chameleon-projector-success"), target, user); Disguise(ent, user, target); return true; @@ -206,7 +226,8 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem return; // reveal first to allow quick switching - TryReveal(user); + if (ent.Comp.Disguised != null) + ClearDisguise(ent, ent.Comp.Disguised.Value); // add actions for controlling transform aspects _actions.AddAction(user, ref proj.NoRotActionEntity, proj.NoRotAction, container: ent); @@ -216,7 +237,7 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem var disguise = SpawnAttachedTo(proj.DisguiseProto, user.ToCoordinates()); - var disguised = AddComp(user); + var disguised = EnsureComp(user); disguised.Disguise = disguise; Dirty(user, disguised); @@ -246,21 +267,38 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem if (!Resolve(ent, ref ent.Comp, false)) return false; - if (TryComp(ent.Comp.Disguise, out var disguise) - && TryComp(disguise.Projector, out var proj)) - { - proj.Disguised = null; - } + if (!TryComp(ent.Comp.Disguise, out var disguise) + || !TryComp(disguise.Projector, out var proj)) + return false; - var xform = Transform(ent); - xform.NoLocalRotation = false; - _xform.Unanchor(ent, xform); + ClearDisguise((disguise.Projector, proj), ent); + _toggle.TryDeactivate(disguise.Projector); - Del(ent.Comp.Disguise); RemComp(ent); return true; } + /// + /// Clears the disguise for the projector, allowing the user to immediately disguise again. + /// + /// The entity for which to clear the disguise + /// The disguised entity. + private void ClearDisguise(Entity ent, Entity disguised) + { + if (!Resolve(disguised, ref disguised.Comp, false)) + return; + + if (ent.Comp.Disguised == null) + return; + + var xform = Transform(ent.Comp.Disguised.Value); + xform.NoLocalRotation = false; + _xform.Unanchor(disguised, xform); + + ent.Comp.Disguised = null; + Del(disguised.Comp.Disguise); + } + /// /// Reveal a projector's user, if any. /// diff --git a/Resources/Prototypes/Catalog/uplink_catalog.yml b/Resources/Prototypes/Catalog/uplink_catalog.yml index 6b56eced0d..c800eddab7 100644 --- a/Resources/Prototypes/Catalog/uplink_catalog.yml +++ b/Resources/Prototypes/Catalog/uplink_catalog.yml @@ -847,9 +847,9 @@ productEntity: ChameleonProjector discountCategory: rareDiscounts discountDownTo: - Telecrystal: 4 + Telecrystal: 2 cost: - Telecrystal: 7 + Telecrystal: 3 categories: - UplinkDeception diff --git a/Resources/Prototypes/Entities/Objects/Devices/chameleon_projector.yml b/Resources/Prototypes/Entities/Objects/Devices/chameleon_projector.yml index 9260574c66..e69b092afa 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/chameleon_projector.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/chameleon_projector.yml @@ -1,12 +1,18 @@ - type: entity parent: [BaseItem, BaseSyndicateContraband] - id: ChameleonProjector + id: ChameleonProjectorNoBattery name: chameleon projector description: Holoparasite technology used to create a hard-light replica of any object around you. Disguise is destroyed when picked up or deactivated. components: - type: Sprite sprite: /Textures/Objects/Devices/chameleon_projector.rsi - state: icon + layers: + - state: icon + - state: powered + map: [ "enum.PowerDeviceVisualLayers.Powered" ] + - state: decharging + map: [ "enum.PowerDeviceVisualLayers.Charging" ] + visible: false - type: ChameleonProjector whitelist: components: @@ -29,6 +35,44 @@ - type: StaticPrice price: 5000 +- type: entity + parent: ChameleonProjectorNoBattery + id: ChameleonProjector + name: chameleon projector + description: Holoparasite technology used to create a hard-light replica of any object around you. Disguise is destroyed when picked up or deactivated. + suffix: Battery + components: + - type: Appearance + - type: GenericVisualizer + visuals: + enum.BatteryVisuals.State: + enum.PowerDeviceVisualLayers.Powered: + Full: { visible: true } + Neither: { visible: true } + Empty: { visible: false } + enum.BatteryVisuals.Charging: + enum.PowerDeviceVisualLayers.Charging: + Charging: { visible: false } + Decharging: { visible: true } + Constant: { visible: false } + - type: BatteryVisuals + - type: ContainerContainer + containers: + cell_slot: !type:ContainerSlot + - type: ItemSlots + slots: + cell_slot: + name: power-cell-slot-component-slot-name-default + startingItem: PowerCellMedium + - type: PowerCellSlot + cellSlotId: cell_slot + - type: PowerCellDraw + drawRate: 4 # About 3 minutes with a medium cell. + - type: ToggleCellDraw + - type: ItemToggle + onActivate: false + onUse: false + - type: entity categories: [ HideSpawnMenu ] id: ChameleonDisguise diff --git a/Resources/Prototypes/Entities/Objects/Specific/Robotics/borg_modules.yml b/Resources/Prototypes/Entities/Objects/Specific/Robotics/borg_modules.yml index f212354123..7ad58ef5eb 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Robotics/borg_modules.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Robotics/borg_modules.yml @@ -1655,7 +1655,7 @@ - state: icon-xenoborg-projector - type: ItemBorgModule hands: - - item: ChameleonProjector + - item: ChameleonProjectorNoBattery - type: BorgModuleIcon icon: { sprite: Interface/Actions/actions_borg.rsi, state: xenoborg-projector-module } diff --git a/Resources/Textures/Objects/Devices/chameleon_projector.rsi/decharging.png b/Resources/Textures/Objects/Devices/chameleon_projector.rsi/decharging.png new file mode 100644 index 0000000000..a818589da1 Binary files /dev/null and b/Resources/Textures/Objects/Devices/chameleon_projector.rsi/decharging.png differ diff --git a/Resources/Textures/Objects/Devices/chameleon_projector.rsi/icon.png b/Resources/Textures/Objects/Devices/chameleon_projector.rsi/icon.png index ce20b5eeee..2d74fcfb85 100644 Binary files a/Resources/Textures/Objects/Devices/chameleon_projector.rsi/icon.png and b/Resources/Textures/Objects/Devices/chameleon_projector.rsi/icon.png differ diff --git a/Resources/Textures/Objects/Devices/chameleon_projector.rsi/meta.json b/Resources/Textures/Objects/Devices/chameleon_projector.rsi/meta.json index 6a28032ba6..5a007d22ae 100644 --- a/Resources/Textures/Objects/Devices/chameleon_projector.rsi/meta.json +++ b/Resources/Textures/Objects/Devices/chameleon_projector.rsi/meta.json @@ -1,14 +1,17 @@ { "version": 1, "license": "CC-BY-SA-3.0", - "copyright": "Taken from tgstation at https://github.com/tgstation/tgstation/commit/71a1fee2f13730adee5302d34bfa0f0262314d63, Inhands by TiniestShark (github)", + "copyright": "Taken from tgstation at https://github.com/tgstation/tgstation/commit/71a1fee2f13730adee5302d34bfa0f0262314d63, Inhands by TiniestShark (github), decharging, icon and powered seperated by ScarKy0(Github)", "size": { "x": 32, "y": 32 }, "states": [ { - "name": "icon", + "name": "icon" + }, + { + "name": "powered", "delays": [ [ 0.2, @@ -20,6 +23,17 @@ ] ] }, + { + "name": "decharging", + "delays": [ + [ + 0.2, + 0.2, + 0.2, + 0.2 + ] + ] + }, { "name": "inhand-left", "directions": 4 diff --git a/Resources/Textures/Objects/Devices/chameleon_projector.rsi/powered.png b/Resources/Textures/Objects/Devices/chameleon_projector.rsi/powered.png new file mode 100644 index 0000000000..628dac6f3d Binary files /dev/null and b/Resources/Textures/Objects/Devices/chameleon_projector.rsi/powered.png differ