3 string m_SoundsetBuildStart;
4 string m_SoundsetBuildLoop;
5 string m_SoundsetBuildFinish;
14 m_Text =
"#build_shelter_leather";
19 DestroyActionLoopSound();
22 override void CreateConditionComponents()
28 override string GetText()
36 if ( constrution_part )
39 switch (constrution_part.GetName())
42 ret =
"#build_shelter_leather";
46 ret =
"#build_shelter_fabric";
50 ret =
"#build_shelter_stick";
64 if ( constrution_part )
66 switch (constrution_part.GetName())
69 m_Text =
"#build_shelter_leather";
73 m_Text =
"#build_shelter_fabric";
77 m_Text =
"#build_shelter_stick";
83 override bool CanBeUsedLeaning()
88 override typename GetInputType()
93 override bool UseMainItem()
98 override bool HasProgress()
103 override bool HasAlternativeInterrupt()
111 if (player.GetBrokenLegs() ==
eBrokenLegs.BROKEN_LEGS)
114 if (target.GetObject() && !target.GetObject().CanUseConstructionBuild())
116 if ( player.IsPlacingLocal() || player.IsPlacingServer() )
119 if ( (!
GetGame().IsDedicatedServer()) )
121 if ( MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item,
m_VariantID ) )
133 if ( super.SetupAction( player, target, item, action_data, extra_data ) )
135 if ( !
GetGame().IsDedicatedServer() )
138 BuildPartActionData.Cast(action_data).m_PartType = construction_action_data.GetBuildPartNoToolAtIndex(
m_VariantID).GetPartName();
148 BuildPartActionData action_data =
new BuildPartActionData;
154 super.WriteToContext(ctx, action_data);
156 ctx.Write(BuildPartActionData.Cast(action_data).m_PartType);
159 override bool ReadFromContext(
ParamsReadContext ctx, out ActionReciveData action_recive_data )
162 super.ReadFromContext(ctx, action_recive_data);
165 if ( ctx.Read(part_type) )
176 override void HandleReciveData(ActionReciveData action_recive_data,
ActionData action_data)
178 super.HandleReciveData(action_recive_data, action_data);
183 override bool ActionConditionContinue(
ActionData action_data )
186 Construction construction = base_building.GetConstruction();
187 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
190 check_data.m_PartName = part_name;
191 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
193 return !construction.IsCollidingEx( check_data ) && construction.CanBuildPart( part_name, action_data.m_MainItem,
false );
196 override void OnStart(
ActionData action_data )
198 super.OnStart(action_data);
199 action_data.m_Player.TryHideItemInHands(
true);
202 override void OnStartClient(
ActionData action_data )
204 super.OnStartClient(action_data);
206 DetermineConstructionSounds(action_data);
207 PlayActionStartSound(action_data);
210 override void OnStartAnimationLoopClient(
ActionData action_data )
212 super.OnStartAnimationLoopClient(action_data);
214 PlayActionLoopSound(action_data);
219 super.OnEnd(action_data);
220 action_data.m_Player.TryHideItemInHands(
false);
223 override void OnEndClient(
ActionData action_data )
225 super.OnEndClient(action_data);
227 StopActionLoopSound();
231 override void OnFinishProgressServer(
ActionData action_data )
234 Construction construction = base_building.GetConstruction();
236 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
238 if ( !construction.IsColliding( part_name ) && construction.CanBuildPart( part_name, action_data.m_MainItem,
false ) )
241 construction.BuildPartServer( action_data.m_Player, part_name,
AT_BUILD_PART );
247 override void OnFinishProgressClient(
ActionData action_data )
249 super.OnFinishProgressClient(action_data);
251 PlayActionFinishSound(action_data);
254 void DetermineConstructionSounds(
ActionData action_data )
258 if (constrution_part)
260 switch (constrution_part.GetName())
263 m_SoundsetBuildStart =
"Shelter_Leather_Build_Start_SoundSet";
264 m_SoundsetBuildLoop =
"Shelter_Leather_Build_Loop_SoundSet";
265 m_SoundsetBuildFinish =
"Shelter_Leather_Build_Finish_SoundSet";
269 m_SoundsetBuildStart =
"Shelter_Fabric_Build_Start_SoundSet";
270 m_SoundsetBuildLoop =
"Shelter_Fabric_Build_Loop_SoundSet";
271 m_SoundsetBuildFinish =
"Shelter_Fabric_Build_Finish_SoundSet";
275 m_SoundsetBuildStart =
"Shelter_Wooden_Stick_Build_Start_SoundSet";
276 m_SoundsetBuildLoop =
"Shelter_Wooden_Stick_Build_Loop_SoundSet";
277 m_SoundsetBuildFinish =
"Shelter_Wooden_Stick_Build_Finish_SoundSet";
281 m_SoundsetBuildStart =
"";
282 m_SoundsetBuildLoop =
"";
283 m_SoundsetBuildFinish =
"";
289 void PlayActionStartSound(
ActionData action_data )
292 sound.SetAutodestroy(
true );
295 void PlayActionLoopSound(
ActionData action_data )
297 if ( !m_BuildLoopSound || !m_BuildLoopSound.IsSoundPlaying() )
299 m_BuildLoopSound =
SEffectManager.PlaySound( m_SoundsetBuildLoop, action_data.m_Target.GetObject().GetPosition(), 0, 0,
true );
303 void StopActionLoopSound()
305 if (m_BuildLoopSound)
307 m_BuildLoopSound.SetSoundFadeOut(0.5);
308 m_BuildLoopSound.SoundStop();
312 void DestroyActionLoopSound()
317 void PlayActionFinishSound(
ActionData action_data )
320 sound.SetAutodestroy(
true );
323 override string GetSoundCategory(
ActionData action_data)
325 return "Base_building";