Esempio n. 1
0
        //For now allow only emag hacking for setting 3
        private void TryEmagController(HandApply interaction)
        {
            if (isHacked)
            {
                Chat.AddExamineMsgFromServer(interaction.Performer, $"The {gameObject.ExpensiveName()} has already been hacked!");
                return;
            }

            Chat.AddActionMsgToChat(interaction.Performer, $"You attempt to hack the {gameObject.ExpensiveName()}, this will take around {timeToHack} seconds",
                                    $"{interaction.Performer.ExpensiveName()} starts hacking the {gameObject.ExpensiveName()}");

            var cfg = new StandardProgressActionConfig(StandardProgressActionType.Restrain);

            StandardProgressAction.Create(
                cfg,
                () => FinishHack(interaction)
                ).ServerStartProgress(ActionTarget.Object(registerTile), timeToHack, interaction.Performer);
        }
Esempio n. 2
0
 /// <summary>
 /// Performs common tool usage logic, such as playing the correct sound.
 /// If item is not a tool, simply performs the progress action normally.
 /// </summary>
 /// <param name="handApply">hand apply causing the tool usage</param>
 /// <param name="seconds">seconds taken to perform the action, 0 for instant.</param>
 /// <param name="progressCompleteAction">completion callback</param>
 /// <param name="playSound">Whether to play default tool sound</param>
 /// <returns>progress bar spawned, null if progress did not start</returns>
 public static ProgressBar ServerUseTool(HandApply handApply, float seconds = 0,
                                         Action progressCompleteAction      = null, bool playSound = true)
 {
     return(ServerUseTool(handApply.Performer, handApply.HandObject,
                          ActionTarget.Object(handApply.TargetObject.RegisterTile()), seconds, progressCompleteAction, playSound));
 }
Esempio n. 3
0
 /// <summary>
 /// Start a progress action targeting a specific object.
 /// Tries to create and begin animating a progress bar for a specific player. Returns null
 /// if progress did not begin for some reason.
 /// </summary>
 /// <param name="progressAction">progress action being performed</param>
 /// <param name="target">targeted object of the progress action</param>
 /// <param name="timeForCompletion">how long in seconds the action should take</param>
 /// <param name="player">player performing the action</param>
 /// <returns>progress bar associated with this action (can use this to interrupt progress). Null if
 /// progress was not started for some reason (such as already in progress for this action on the specified tile).</returns>
 public static ProgressBar ServerStartProgress(this IProgressAction progressAction, RegisterTile target,
                                               float timeForCompletion,
                                               GameObject player)
 {
     return(UIManager._ServerStartProgress(progressAction, ActionTarget.Object(target), timeForCompletion, player));
 }