Пример #1
0
        public static void RegisterPosting(HaulExplicitlyPosting posting)
        {
            HaulExplicitlyJobManager manager = GetManager(posting.map);

            foreach (Thing i in posting.items)
            {
                {
                    ThingWithComps twc = i as ThingWithComps;
                    if (twc != null && twc.GetComp <CompForbiddable>() != null)
                    {
                        i.SetForbidden(false);
                    }
                }
                if (i.IsAHaulableSetToHaulable())
                {
                    i.ToggleHaulDesignation();
                }
                foreach (var p2 in manager.postings.Values)
                {
                    p2.TryRemoveItem(i);
                }
            }
            if (manager.postings.Keys.Contains(posting.id))
            {
                throw new ArgumentException("Posting ID " + posting.id + " already exists in this manager.");
            }
            manager.postings[posting.id] = posting;
        }
Пример #2
0
        public static HaulExplicitlyJobManager GetManager(Map map)
        {
            var self = GetInstance();
            HaulExplicitlyJobManager r = self.managers.TryGetValue(map.uniqueID);

            if (r != null)
            {
                return(r);
            }
            var mgr = new HaulExplicitlyJobManager(map);

            self.managers[map.uniqueID] = mgr;
            return(mgr);
        }