Action container rejig (#20260)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -15,20 +15,18 @@ public abstract class SharedSpiderSystem : EntitySystem
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<SpiderComponent, ComponentStartup>(OnSpiderStartup);
|
||||
SubscribeLocalEvent<SpiderComponent, MapInitEvent>(OnInit);
|
||||
SubscribeLocalEvent<SpiderWebObjectComponent, ComponentStartup>(OnWebStartup);
|
||||
}
|
||||
|
||||
private void OnSpiderStartup(EntityUid uid, SpiderComponent component, ComponentStartup args)
|
||||
private void OnInit(EntityUid uid, SpiderComponent component, MapInitEvent args)
|
||||
{
|
||||
if (_net.IsClient)
|
||||
return;
|
||||
|
||||
_action.AddAction(uid, Spawn(component.WebAction), null);
|
||||
_action.AddAction(uid, ref component.Action, component.WebAction, uid);
|
||||
}
|
||||
|
||||
private void OnWebStartup(EntityUid uid, SpiderWebObjectComponent component, ComponentStartup args)
|
||||
{
|
||||
// TODO dont use this. use some general random appearance system
|
||||
_appearance.SetData(uid, SpiderWebVisuals.Variant, _robustRandom.Next(1, 3));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ public sealed partial class SpiderComponent : Component
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("webAction", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
public string WebAction = "ActionSpiderWeb";
|
||||
|
||||
[DataField] public EntityUid? Action;
|
||||
}
|
||||
|
||||
public sealed partial class SpiderWebActionEvent : InstantActionEvent { }
|
||||
|
||||
Reference in New Issue
Block a user