示例#1
0
        // Function from file: spirit_board.dm
        public bool spirit_board_checks(dynamic M = null)
        {
            int        bonus          = 0;
            dynamic    light_amount   = null;
            dynamic    T              = null;
            int        users_in_range = 0;
            Mob_Living L              = null;

            bonus = 0;

            if (M.ckey == this.lastuser)
            {
                bonus = 10;
            }

            if (this.cooldown > Game13.time - (bonus + 30))
            {
                return(false);
            }
            light_amount = 0;
            T            = GlobalFuncs.get_turf(this);
            light_amount = ((Tile)T).get_lumcount();

            if (Convert.ToDouble(light_amount) > 2)
            {
                M.WriteMsg("<span class='warning'>It's too bright here to use " + this.name + "!</span>");
                return(false);
            }
            users_in_range = 0;

            foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInRangeExcludeThis(this, 1), typeof(Mob_Living)))
            {
                L = _a;


                if (Lang13.Bool(L.ckey) && L.client != null)
                {
                    if (Game13.time - L.client.inactivity < Game13.time - 300 || L.stat != 0 || L.restrained())
                    {
                        M.WriteMsg("<span class='warning'>" + L + " doesn't seem to be paying attention...</span>");
                    }
                    else
                    {
                        users_in_range++;
                    }
                }
            }

            if (users_in_range < 2)
            {
                M.WriteMsg("<span class='warning'>There aren't enough people to use the " + this.name + "!</span>");
                return(false);
            }
            return(true);
        }