Skip to content

Commit

Permalink
Merge branch 'master' into Floofstation-V7
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxxoTrystan committed Dec 7, 2024
2 parents 8af552c + 0942002 commit e2378ad
Show file tree
Hide file tree
Showing 18 changed files with 309 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Content.Server/Chat/Systems/ChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace Content.Server.Chat.Systems;

// Dear contributor. When I was introducing changes to this system only god and I knew what I was doing.
// Now only god knows. Please don't touch this code ever again. If you do have to, increment this counter as a warning for others:
// TOTAL_HOURS_WASTED_HERE_EE = 17
// TOTAL_HOURS_WASTED_HERE_EE = 18

// TODO refactor whatever active warzone this class and chatmanager have become
/// <summary>
Expand Down
13 changes: 13 additions & 0 deletions Content.Server/Polymorph/Components/PolymorphProviderComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Content.Server.Polymorph.Systems;
using Content.Shared.Polymorph;
using Robust.Shared.Prototypes;

namespace Content.Server.Polymorph.Components;

[RegisterComponent]
[Access(typeof(PolymorphSystem))]
public sealed partial class PolymorphProviderComponent : Component
{
[DataField]
public ProtoId<PolymorphPrototype> Polymorph;
}
31 changes: 31 additions & 0 deletions Content.Server/Polymorph/Systems/PolymorphSystem.Provider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Content.Server.Actions;
using Content.Server.Polymorph.Components;
using Content.Shared.Actions;
using Content.Shared.Inventory.Events;
using Content.Shared.Polymorph;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;

namespace Content.Server.Polymorph.Systems;

public sealed partial class PolymorphSystem
{
private void InitializeProvider()
{
SubscribeLocalEvent<PolymorphProviderComponent, GotEquippedEvent>(OnEquipped);
SubscribeLocalEvent<PolymorphProviderComponent, GotUnequippedEvent>(OnUnEquipped);
}

private void OnUnEquipped(EntityUid uid, PolymorphProviderComponent component, ref GotUnequippedEvent args)
{
if (TryComp<PolymorphableComponent>(args.Equipee, out var polymorphable))
RemovePolymorphAction(component.Polymorph, (args.Equipee, polymorphable));
}

private void OnEquipped(EntityUid uid, PolymorphProviderComponent component, ref GotEquippedEvent args)
{
var polymorphable = EnsureComp<PolymorphableComponent>(args.Equipee);
CreatePolymorphAction(component.Polymorph, (args.Equipee, polymorphable));
}

}
21 changes: 20 additions & 1 deletion Content.Server/Polymorph/Systems/PolymorphSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using Robust.Server.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager;
using Robust.Shared.Timing;
using Robust.Shared.Utility;

Expand All @@ -31,6 +32,7 @@ public sealed partial class PolymorphSystem : EntitySystem
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly ISerializationManager _serialization = default!;
[Dependency] private readonly ActionsSystem _actions = default!;
[Dependency] private readonly AudioSystem _audio = default!;
[Dependency] private readonly SharedBuckleSystem _buckle = default!;
Expand Down Expand Up @@ -62,6 +64,7 @@ public override void Initialize()

InitializeCollide();
InitializeMap();
InitializeProvider();
}

public override void Update(float frameTime)
Expand Down Expand Up @@ -201,6 +204,19 @@ private void OnDestruction(Entity<PolymorphedEntityComponent> ent, ref Destructi

var child = Spawn(configuration.Entity, _transform.GetMapCoordinates(uid, targetTransformComp), rotation: _transform.GetWorldRotation(uid));

// Copy specified components over
foreach (var compName in configuration.CopiedComponents)
{
if (!_compFact.TryGetRegistration(compName, out var reg)
|| !EntityManager.TryGetComponent(uid, reg.Idx, out var comp))
continue;

var copy = _serialization.CreateCopy(comp, notNullableOverride: true);
copy.Owner = child;
AddComp(child, copy, true);
}

// Ensure the resulting entity is sentient (why? this sucks)
MakeSentientCommand.MakeSentient(child, EntityManager);

var polymorphedComp = _compFact.GetComponent<PolymorphedEntityComponent>();
Expand Down Expand Up @@ -350,8 +366,11 @@ private void OnDestruction(Entity<PolymorphedEntityComponent> ent, ref Destructi
public void CreatePolymorphAction(ProtoId<PolymorphPrototype> id, Entity<PolymorphableComponent> target)
{
target.Comp.PolymorphActions ??= new();
if (target.Comp.PolymorphActions.ContainsKey(id))
if (target.Comp.PolymorphActions.TryGetValue(id, out var actionBla))
{
_actions.AddAction(target, actionBla, target);
return;
}

if (!_proto.TryIndex(id, out var polyProto))
return;
Expand Down
11 changes: 11 additions & 0 deletions Content.Shared/Polymorph/PolymorphPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,17 @@ public sealed partial record PolymorphConfiguration
[DataField(serverOnly: true)]
[ViewVariables(VVAccess.ReadWrite)]
public TimeSpan Cooldown = TimeSpan.Zero;

/// <summary>
/// The exact names of components to copy over when this polymorph is applied.
/// </summary>
[DataField(serverOnly: true)]
public HashSet<string> CopiedComponents = new()
{
"LanguageKnowledge",
"LanguageSpeaker",
"Grammar"
};
}

public enum PolymorphInventoryChange : byte
Expand Down
22 changes: 22 additions & 0 deletions Resources/Changelog/Floof.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1707,3 +1707,25 @@ Entries:
id: 224
time: '2024-12-05T16:33:52.0000000+00:00'
url: https://github.com/Fansana/floofstation1/pull/393
- author: Mnemotechnician
changes:
- type: Tweak
message: >-
Added languages to certain entities that lacked them, including MMIs and
positronic brains.
- type: Add
message: >-
Polymorphing into another entity now preserves your languages and
grammar.
- type: Tweak
message: Cherry-picked some changes to languages made upstream.
id: 225
time: '2024-12-07T02:43:21.0000000+00:00'
url: https://github.com/Fansana/floofstation1/pull/395
- author: fenndragon
changes:
- type: Fix
message: 'Fixed mining drill '
id: 226
time: '2024-12-07T06:16:59.0000000+00:00'
url: https://github.com/Fansana/floofstation1/pull/383
9 changes: 9 additions & 0 deletions Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,9 @@
behaviors:
- !type:GibBehavior { }
- type: NonSpreaderZombie
- type: LanguageKnowledge
speaks: [Hissing]
understands: [Hissing]

- type: entity
name: glockroach
Expand Down Expand Up @@ -2118,6 +2121,9 @@
- type: RandomBark
barkType: penguin
barkMultiplier: 0.6
- type: LanguageKnowledge
speaks: [Penguin]
understands: [Penguin]

- type: entity
name: grenade penguin
Expand Down Expand Up @@ -2238,6 +2244,9 @@
minTime: 10
maxTime: 50 # It's a sssnake...
barkType: hissing
- type: LanguageKnowledge
speaks: [Hissing]
understands: [Hissing]

# Code unique spider prototypes or combine them all into one spider and get a
# random sprite state when you spawn it.
Expand Down
3 changes: 3 additions & 0 deletions Resources/Prototypes/Entities/Mobs/NPCs/glimmer_creatures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,6 @@
- type: NPCRetaliation
attackMemoryLength: 10
- type: NPCRangedCombat
# other
- type: LanguageSpeaker
- type: UniversalLanguageSpeaker # Should it speak unversal or some other language?
2 changes: 2 additions & 0 deletions Resources/Prototypes/Entities/Mobs/NPCs/revenant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,5 @@
powersToAdd:
- XenoglossyPower
- TelepathyPower
- type: LanguageSpeaker
- type: UniversalLanguageSpeaker
4 changes: 4 additions & 0 deletions Resources/Prototypes/Entities/Objects/Devices/pda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@
- DoorBumpOpener
- type: Input
context: "human"
- type: LanguageSpeaker
- type: LanguageKnowledge
speaks: [TauCetiBasic, RobotTalk]
understands: [TauCetiBasic, RobotTalk]

- type: entity
parent: BasePDA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
- type: GuideHelp
guides:
- Cyborgs
- type: LanguageSpeaker
- type: LanguageKnowledge
speaks: [TauCetiBasic, RobotTalk]
understands: [TauCetiBasic, RobotTalk]

- type: entity
parent: MMI
Expand Down Expand Up @@ -124,3 +128,7 @@
guides:
- Cyborgs
- type: Organ # Estacao Pirata - IPCs
- type: LanguageSpeaker
- type: LanguageKnowledge
speaks: [RobotTalk]
understands: [RobotTalk]
11 changes: 6 additions & 5 deletions Resources/Prototypes/Entities/Objects/Weapons/Melee/pickaxe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,18 @@
wideAnimationRotation: -90
soundHit:
path: "/Audio/Items/drill_hit.ogg"
attackRate: 1.2
attackRate: 4
range: 1.5
damage:
types:
Blunt: 6
Slash: 3
Structural: 12
bluntStaminaDamageFactor: 4.0
Blunt: 2
Slash: 1
Structural: 15
bluntStaminaDamageFactor: 1
heavyRateModifier: 1
heavyRangeModifier: 2
heavyDamageBaseModifier: 1
heavyStaminaCost: 0
angle: 20

- type: ReverseEngineering # Nyano
Expand Down
144 changes: 144 additions & 0 deletions Resources/Prototypes/Floof/Entities/Clothing/Neck/amulet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@

- type: entity
parent: ClothingNeckBase
id: ClothingNeckDragonAmuletPolymorph
name: dragon amulet
description: A beautiful gold amulet, featuring a ruby that shines with an otherworldly glow.
components:
- type: Sprite
sprite: Floof/Clothing/Neck/amulet_dragon.rsi
- type: Clothing
sprite: Floof/Clothing/Neck/amulet_dragon.rsi
- type: PolymorphProvider
polymorph: PolymorphDragonRubyFang

- type: polymorph
id: PolymorphDragonRubyFang
configuration:
entity: MobDragonRubyFang
forced: false
inventory: None
transferName: true
transferDamage: true
revertOnCrit: true
revertOnDeath: true

- type: entity
parent: [ SimpleSpaceMobBase, FlyingMobBase ]
id: MobDragonRubyFang
suffix: ""
name: Rubyfang
description: A giant dragon, probably a couple thousand years old.
components:
- type: Bloodstream
bloodMaxVolume: 650
- type: Speech
speechVerb: LargeMob
- type: CombatMode
- type: MobMover
- type: InputMover
- type: MovementSpeedModifier
baseWalkSpeed: 3
baseSprintSpeed: 5
weightlessModifier: 1.5
- type: Sprite
color: "#cc0000ff"
sprite: Mobs/Aliens/Carps/dragon.rsi
noRot: true
layers:
- map: [ "enum.DamageStateVisualLayers.Base" ]
state: alive
- map: [ "enum.DamageStateVisualLayers.BaseUnshaded" ]
state: alive-unshaded
shader: unshaded
- type: Appearance
- type: DamageStateVisuals
states:
Alive:
Base: alive
BaseUnshaded: alive-unshaded
Critical:
Base: crit
Dead:
Base: dead
BaseUnshaded: dead-unshaded
- type: Physics
bodyType: KinematicController
- type: Fixtures
fixtures:
fix1:
shape:
!type:PhysShapeCircle
radius: 0.40
density: 100
mask:
- FlyingMobMask
layer:
- FlyingMobLayer
- type: MobState
- type: MobStateActions
actions:
Critical:
- ActionCritSuccumb
- ActionCritLastWords
- type: MobThresholds
thresholds:
0: Alive
450: Critical
500: Dead
- type: SlowOnDamage
speedModifierThresholds:
250: 0.7
400: 0.5
# disable taking damage from fire, since its a fire breathing dragon
- type: Flammable
damage:
types: {}
- type: Temperature
heatDamageThreshold: 800
- type: Metabolizer
solutionOnBody: false
updateInterval: 0.25
metabolizerTypes: [ Dragon ]
groups:
- id: Medicine
- id: Poison
- type: Butcherable
spawned:
- id: FoodMeatDragon
amount: 2
- type: InteractionPopup
successChance: 0.25 # It's no goose, but you better smell like carp.
interactSuccessString: petting-success-dragon
interactFailureString: petting-failure-dragon
interactFailureSound:
path: /Audio/Animals/space_dragon_roar.ogg
soundPerceivedByOthers: false # A 75% chance for a loud roar would get old fast.
- type: MeleeWeapon
altDisarm: false
soundHit:
path: /Audio/Weapons/Xeno/alien_claw_flesh3.ogg
damage:
types:
Piercing: 15
Slash: 15
- type: Devourer
foodPreference: Humanoid
shouldStoreDevoured: true
chemical: Ichor
healRate: 15.0
whitelist:
components:
- MobState
- Door
tags:
- Wall
- type: Tag
tags:
- CannotSuicide
- DoorBumpOpener
- type: UserInterface
- type: Puller
needsHands: false
- type: Hands

Loading

0 comments on commit e2378ad

Please sign in to comment.