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

Fix new /turf(loc) not updating name and desc #1559

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 0 additions & 7 deletions OpenDreamRuntime/AtomManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,6 @@ public EntityUid CreateMovableEntity(DreamObjectMovable movable) {
DMISpriteComponent sprite = _entityManager.AddComponent<DMISpriteComponent>(entity);
sprite.SetAppearance(GetAppearanceFromDefinition(movable.ObjectDefinition));

if (_entityManager.TryGetComponent(entity, out MetaDataComponent? metaData)) {
_metaDataSystem ??= _entitySystemManager.GetEntitySystem<MetaDataSystem>();

_metaDataSystem.SetEntityName(entity, movable.GetDisplayName(), metaData);
_metaDataSystem.SetEntityDescription(entity, movable.Desc ?? string.Empty, metaData);
}

_entityToAtom.Add(entity, movable);
return entity;
}
Expand Down
1 change: 1 addition & 0 deletions OpenDreamRuntime/Objects/DreamObjectTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public void LoadJson(DreamCompiledJson json) {
_entitySystemManager.TryGetEntitySystem(out _appearanceSystem);
_entitySystemManager.TryGetEntitySystem(out _transformSystem);
_entitySystemManager.TryGetEntitySystem(out _pvsOverrideSystem);
_entitySystemManager.TryGetEntitySystem(out _metaDataSystem);

Strings = json.Strings ?? new();

Expand Down
11 changes: 7 additions & 4 deletions OpenDreamRuntime/Objects/Types/DreamObjectAtom.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using OpenDreamShared.Dream;
using OpenDreamRuntime.Procs;
using OpenDreamShared.Dream;

namespace OpenDreamRuntime.Objects.Types;

Expand All @@ -14,9 +15,6 @@ public class DreamObjectAtom : DreamObject {
public DreamList? VisLocs; // TODO: Implement

public DreamObjectAtom(DreamObjectDefinition objectDefinition) : base(objectDefinition) {
ObjectDefinition.Variables["name"].TryGetValueAsString(out Name);
ObjectDefinition.Variables["desc"].TryGetValueAsString(out Desc);

Overlays = new(ObjectTree.List.ObjectDefinition, this, AppearanceSystem, false);
Underlays = new(ObjectTree.List.ObjectDefinition, this, AppearanceSystem, true);
VisContents = new(ObjectTree.List.ObjectDefinition, PvsOverrideSystem, this);
Expand All @@ -26,6 +24,11 @@ public DreamObjectAtom(DreamObjectDefinition objectDefinition) : base(objectDefi
AtomManager.AddAtom(this);
}

public override void Initialize(DreamProcArguments args) {
ObjectDefinition.Variables["name"].TryGetValueAsString(out Name);
ObjectDefinition.Variables["desc"].TryGetValueAsString(out Desc);
}

protected override void HandleDeletion() {
AtomManager.RemoveAtom(this);

Expand Down
12 changes: 8 additions & 4 deletions OpenDreamRuntime/Objects/Types/DreamObjectMovable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using OpenDreamRuntime.Rendering;
using OpenDreamShared.Dream;
using Robust.Shared.Map;
using Robust.Shared.Utility;

namespace OpenDreamRuntime.Objects.Types;

Expand Down Expand Up @@ -40,14 +39,19 @@ public DreamObjectMovable(DreamObjectDefinition objectDefinition) : base(objectD
Entity = AtomManager.CreateMovableEntity(this);
SpriteComponent = EntityManager.GetComponent<DMISpriteComponent>(Entity);
_transformComponent = EntityManager.GetComponent<TransformComponent>(Entity);

objectDefinition.Variables["screen_loc"].TryGetValueAsString(out var screenLoc);
ScreenLoc = screenLoc;
}

public override void Initialize(DreamProcArguments args) {
base.Initialize(args);

ObjectDefinition.Variables["screen_loc"].TryGetValueAsString(out var screenLoc);
ScreenLoc = screenLoc;

if (EntityManager.TryGetComponent(Entity, out MetaDataComponent? metaData)) {
MetaDataSystem?.SetEntityName(Entity, GetDisplayName(), metaData);
MetaDataSystem?.SetEntityDescription(Entity, Desc ?? string.Empty, metaData);
}

args.GetArgument(0).TryGetValueAsDreamObject<DreamObjectAtom>(out var loc);
SetLoc(loc); //loc is set before /New() is ever called
}
Expand Down