Ejemplo n.º 1
0
        ////////////////

        public void RefreshModLockButton(HamstarHelpersMod mymod)
        {
            bool   are_mods_locked = ModLockHelpers.IsWorldLocked();
            string status          = are_mods_locked ? ": ON" : ": OFF";
            bool   is_enabled      = true;

            if (!mymod.Config.WorldModLockEnable)
            {
                status    += " (disabled)";
                is_enabled = false;
            }
            else if (Main.netMode != 0)
            {
                status    += " (single-player only)";
                is_enabled = false;
            }

            if (!is_enabled)
            {
                if (this.ModLockButton.IsEnabled)
                {
                    this.ModLockButton.Disable();
                }
            }
            else
            {
                if (!this.ModLockButton.IsEnabled)
                {
                    this.ModLockButton.Enable();
                }
            }

            this.ModLockButton.SetText(UIControlPanel.ModLockTitle + status);
        }
Ejemplo n.º 2
0
        private void ToggleModLock(HamstarHelpersMod mymod)
        {
            if (!ModLockHelpers.IsWorldLocked())
            {
                ModLockHelpers.LockWorld();
            }
            else
            {
                ModLockHelpers.UnlockWorld();
            }

            this.RefreshModLockButton(mymod);
        }
Ejemplo n.º 3
0
        ////////////////

        public override void Action(CommandCaller caller, string input, string[] args)
        {
            //if( Main.netMode != 0 && !UserHelpers.UserHelpers.IsAdmin(caller.Player) ) {
            //	throw new UsageException( "Only admins are allowed to use this command.", Color.Red );
            //}

            if (ModLockHelpers.IsWorldLocked())
            {
                caller.Reply("World unlocked.", Color.GreenYellow);
                ModLockHelpers.UnlockWorld();
            }
            else
            {
                caller.Reply("World locked.", Color.GreenYellow);
                ModLockHelpers.LockWorld();
            }
        }