Beispiel #1
0
        static SyncAction <T, A, B, C> RegisterActions <T, A, B, C>(Func <A, B, C, IEnumerable <T> > func, ActionGetter <T> actionGetter)
        {
            var sync = new SyncAction <T, A, B, C>(func, actionGetter);

            Sync.handlers.Add(sync);

            return(sync);
        }
Beispiel #2
0
        public static void Init()
        {
            SyncWorldObjCaravanMenus = RegisterActions((WorldObject obj, Caravan c) => obj.GetFloatMenuOptions(c), o => ref o.action);
            SyncWorldObjCaravanMenus.PatchAll(nameof(WorldObject.GetFloatMenuOptions));

            SyncTransportPodMenus = RegisterActions((WorldObject obj, IEnumerable <IThingHolder> p, CompLaunchable r) => obj.GetTransportPodsFloatMenuOptions(p, r), o => ref o.action);
            SyncTransportPodMenus.PatchAll(nameof(WorldObject.GetTransportPodsFloatMenuOptions));
        }