Exemplo n.º 1
0
                }                                                                                                                                         //RelativeBlocks (Tags | Ids, Relative Coordinate)

                public bool ConditionMet(BlockInfo blockInfo, BlockCollection blockCollection, Vector3 pos, ResourceList res = null)
                {
                    SetParamList();
                    if (_paramslist != null && blockInfo.Model.Params != null) //Match Params
                    {
                        if (!Universal.Match(blockInfo.Model.Params.Split(',').ToList(), _paramslist))
                        {
                            return(false);                                                                           //When Params of BlockInfo Not Include Params of ModelInfoCondition
                        }
                    }
                    if (_relativeBlocks != null) //Match RelativeBlocks
                    {
                        foreach (var info in _relativeBlocks.Keys)
                        {
                            if (res != null)
                            {
                                var _b = res.SimpleBlockInfoCollection(info);
                                var b  = blockCollection.GetBlock((int)(_relativeBlocks[info].X + pos.X), (int)(_relativeBlocks[info].Y + pos.Y), (int)(_relativeBlocks[info].Z + pos.Z));
                                if (b != null && _b != null)
                                {
                                    var success = _b.Find((SimpleBlockInfo __b) => Universal.MatchBlock(b.GetBlockInfo(), __b));
                                    if (success == null)
                                    {
                                        return(false);                //When Blocks Not Match
                                    }
                                }
                                else
                                {
                                    return(false);
                                }
                            }
                        }
                    }
                    return(true);
                }
Exemplo n.º 2
0
 public void SetTag(Dictionary <string, List <SimpleBlockInfo> > blockTagList)
 {
     foreach (var tag in blockTagList.Keys)
     {
         foreach (var target in blockTagList[tag])
         {
             if (Universal.MatchBlock(this, target))
             {
                 TagAdd(tag);
             }
         }
     }
 }