コード例 #1
0
        /// <summary>
        /// purpose of this is to allow the player to put peds into the prison cells (models defined in settings)
        /// </summary>
        private void PutPedsIntoPrisonCells()
        {
            // here's how I'd like this to go:
            // 1. We find the closest prop with the "prisoncellmodel"
            // 2. Once we go up to it, we press e on the cell, and it will teleport a ped into it. (the first ped in the array) (maybe we do a screen fade or something??)
            // 3. Then it's complete and we can continue to do it over and over but we need to make sure that there's no peds attached to the given prop before doing that.

            Prop closestPrisonCellProp;

            // Make sure the closest prop exists and that there's no ped "attached to that point", the way we check for that is by seeing if
            // there's a ped at the offset from the prop, which (the offset) was defined in the settings.
            if (GetClosestPrisonCell(out closestPrisonCellProp) && Player.Character.CurrentPedGroup.Contains(PedsArrestedByPlayer[0]))
            {
                if (!HelpText.IsActive())
                {
                    _removedHelp2 = false;

                    // display the help text.
                    HelpText.Display("Press ~INPUT_CONTEXT~ to place a ped in this cell.");
                }

                // We're disabling both these controls since their both "relevant", and in most cases bound to the same input button.
                Game.DisableControlThisFrame(2, Control.Talk);
                Game.DisableControlThisFrame(2, Control.Context);

                // let's check for the control press.
                if (Game.IsDisabledControlJustPressed(2, Control.Context))
                {
                    Ped firstPedInStack = PedsArrestedByPlayer[0];

                    // BOOM, we jail'd that sum bitch. KKona!
                    firstPedInStack.Task.ClearAllImmediately();
                    firstPedInStack.AttachTo(closestPrisonCellProp, 0, _offsetOfPedInPrisonCellWhenAttached, new Vector3(0, 0, _rotationOffset));
                    firstPedInStack.LeaveGroup();
                    PedsArrestedByPlayer.RemoveAt(0);
                }
            }
            else
            {
                // now as we've done before let's remove the help text.
                if (!_removedHelp2 && HelpText.IsActive())
                {
                    HelpText.RemoveAll();
                    _removedHelp2 = true;
                }
            }
        }