static void ResetProps(bool global, BlockID block, Player p)
        {
            BlockProps[] scope   = global ? Block.Props : p.level.Props;
            int          changed = scope[block].ChangedScope & BlockOptions.ScopeId(scope);

            if (changed != 0)
            {
                return;
            }

            // properties not manually modified, revert (e.g. make grass die in shadow again)
            scope[block] = BlockOptions.DefaultProps(scope, p.level, block);
            BlockOptions.ApplyChanges(scope, p.level, block, false);
        }
        void SetProps(Player p, BlockProps[] scope, BlockID block, string[] args)
        {
            BlockOption opt = BlockOptions.Find(args[2]);

            if (opt == null)
            {
                Help(p); return;
            }
            string value = args.Length > 3 ? args[3] : "";

            opt.SetFunc(p, scope, block, value);
            scope[block].ChangedScope |= BlockOptions.ScopeId(scope);
            BlockOptions.ApplyChanges(scope, p.level, block, true);
        }
        static List <BlockID> FilterProps(BlockProps[] scope)
        {
            int            changed  = BlockOptions.ScopeId(scope);
            List <BlockID> filtered = new List <BlockID>();

            for (int b = 0; b < scope.Length; b++)
            {
                if ((scope[b].ChangedScope & changed) == 0)
                {
                    continue;
                }
                filtered.Add((BlockID)b);
            }
            return(filtered);
        }
        void CopyProps(Player p, BlockProps[] scope, BlockID block, string[] args)
        {
            if (args.Length < 4)
            {
                Help(p); return;
            }
            BlockID dst = GetBlock(p, scope, args[3]);

            if (dst == Block.Invalid)
            {
                return;
            }

            scope[dst] = scope[block];
            scope[dst].ChangedScope |= BlockOptions.ScopeId(scope);

            p.Message("Copied properties of {0} to {1}",
                      BlockOptions.Name(scope, p, block),
                      BlockOptions.Name(scope, p, dst));
            BlockOptions.ApplyChanges(scope, p.level, block, true);
        }