22
22
using System . Linq ;
23
23
using Content . Shared . Item ;
24
24
using Content . Shared . Hands ;
25
+ using Content . Shared . SS220 . CultYogg . Buildings ;
26
+ using Robust . Shared . Prototypes ;
25
27
26
28
27
29
namespace Content . Shared . SS220 . CultYogg . MiGo ;
@@ -35,13 +37,16 @@ public abstract class SharedMiGoSystem : EntitySystem
35
37
[ Dependency ] private readonly StatusEffectsSystem _statusEffectsSystem = default ! ;
36
38
[ Dependency ] private readonly IGameTiming _timing = default ! ;
37
39
[ Dependency ] private readonly SharedMiGoErectSystem _miGoErectSystem = default ! ;
40
+ [ Dependency ] private readonly SharedMiGoPlantSystem _miGoPlantSystem = default ! ;
38
41
[ Dependency ] private readonly SharedTransformSystem _transform = default ! ;
39
42
[ Dependency ] private readonly SharedCultYoggHealSystem _heal = default ! ;
40
43
[ Dependency ] private readonly SharedAudioSystem _audio = default ! ;
41
44
[ Dependency ] private readonly SharedPopupSystem _popup = default ! ;
42
45
[ Dependency ] private readonly MobStateSystem _mobState = default ! ;
43
46
[ Dependency ] private readonly AlertsSystem _alerts = default ! ;
44
47
[ Dependency ] private readonly SharedEyeSystem _eye = default ! ;
48
+ [ Dependency ] private readonly SharedUserInterfaceSystem _userInterfaceSystem = default ! ;
49
+ [ Dependency ] private readonly IPrototypeManager _proto = default ! ;
45
50
46
51
47
52
//[Dependency] private readonly CultYoggRuleSystem _cultYoggRule = default!; //maybe use this for enslavement
@@ -68,6 +73,8 @@ public override void Initialize()
68
73
SubscribeLocalEvent < MiGoComponent , ThrowAttemptEvent > ( OnThrowAttempt ) ;
69
74
SubscribeLocalEvent < MiGoComponent , BeingUsedAttemptEvent > ( OnBeingUsedAttempt ) ;
70
75
SubscribeLocalEvent < MiGoComponent , GettingPickedUpAttemptEvent > ( OnGettingPickedUpAttempt ) ;
76
+
77
+ SubscribeLocalEvent < MiGoComponent , BoundUIOpenedEvent > ( OnBoundUIOpened ) ;
71
78
}
72
79
73
80
protected virtual void OnCompInit ( Entity < MiGoComponent > uid , ref ComponentStartup args )
@@ -80,7 +87,26 @@ protected virtual void OnCompInit(Entity<MiGoComponent> uid, ref ComponentStartu
80
87
_actions . AddAction ( uid , ref uid . Comp . MiGoSacrificeActionEntity , uid . Comp . MiGoSacrificeAction ) ;
81
88
}
82
89
90
+ private void OnBoundUIOpened ( Entity < MiGoComponent > entity , ref BoundUIOpenedEvent args )
91
+ {
92
+ if ( args . UiKey . ToString ( ) == "Erect" )
93
+ {
94
+ _userInterfaceSystem . SetUiState ( args . Entity , args . UiKey , new MiGoErectBuiState ( )
95
+ {
96
+ Buildings = _proto . GetInstances < CultYoggBuildingPrototype > ( ) . Values . ToList ( ) ,
97
+ } ) ;
98
+ return ;
99
+ }
83
100
101
+ if ( args . UiKey . ToString ( ) == "Plant" )
102
+ {
103
+ _userInterfaceSystem . SetUiState ( args . Entity , args . UiKey , new MiGoPlantBuiState ( )
104
+ {
105
+ Seeds = _proto . GetInstances < CultYoggSeedsPrototype > ( ) . Values . ToList ( ) ,
106
+ } ) ;
107
+ return ;
108
+ }
109
+ }
84
110
85
111
#region Heal
86
112
private void MiGoHeal ( Entity < MiGoComponent > uid , ref MiGoHealEvent args )
@@ -128,7 +154,7 @@ private void MiGoPlant(Entity<MiGoComponent> entity, ref MiGoPlantEvent args)
128
154
if ( ! entity . Comp . IsPhysicalForm )
129
155
return ;
130
156
131
- _miGoErectSystem . OpenUI ( entity , actor ) ;
157
+ _miGoPlantSystem . OpenUI ( entity , actor ) ;
132
158
}
133
159
#endregion
134
160
0 commit comments