public override void DoPostConfigureComplete(GameObject go) { var def = go.AddOrGetDef <RanchStation.Def>(); def.isCreatureEligibleToBeRanchedCb = delegate(GameObject creature_go, RanchStation.Instance ranch_station_smi) { var butcherStation = ranch_station_smi.GetComponent <ButcherStation>(); return(butcherStation?.IsCreatureEligibleToBeButched(creature_go) ?? false); }; def.onRanchCompleteCb = delegate(GameObject creature_go) { ButcherStation.ButchCreature(creature_go, true); }; def.getTargetRanchCell = delegate(RanchStation.Instance smi) { if (!smi.IsNullOrStopped()) { int cell = Grid.CellBelow(Grid.PosToCell(smi.transform.GetPosition())); cell = Grid.OffsetCell(cell, 0, -FishingStationGuide.GetDepthAvailable(smi.gameObject, out _)); if (Grid.IsValidCell(cell)) { return(cell); } } return(Grid.InvalidCell); }; def.interactLoopCount = 1; def.rancherInteractAnim = "anim_interacts_fishingstation_kanim"; def.ranchedPreAnim = "bitehook"; def.ranchedLoopAnim = "caught_loop"; def.ranchedPstAnim = "trapped_pre"; def.synchronizeBuilding = true; Prioritizable.AddRef(go); go.AddOrGet <FishingStationGuide>().type = FishingStationGuide.GuideType.Complete; }
public override void DoPostConfigureComplete(GameObject go) { RanchStation.Def def = go.AddOrGetDef <RanchStation.Def>(); def.isCreatureEligibleToBeRanchedCb = delegate(GameObject creature_go, RanchStation.Instance ranch_station_smi) { ButcherStation butcherStation = ranch_station_smi.GetComponent <ButcherStation>(); if (butcherStation != null) { return(butcherStation.IsCreatureEligibleToBeButched(creature_go)); } return(false); }; def.onRanchCompleteCb = delegate(GameObject creature_go) { /* * RanchStation.Instance smi = creature_go.GetSMI<RanchableMonitor.Instance>()?.targetRanchStation; * if (smi != null) * { * creature_go.transform.SetPosition(smi.transform.GetPosition()); * } * creature_go.GetSMI<DeathMonitor.Instance>()?.Kill(Db.Get().Deaths.Generic); */ ButcherStation.ButchCreature(creature_go, true); }; def.getTargetRanchCell = delegate(RanchStation.Instance smi) { int num = Grid.InvalidCell; if (!smi.IsNullOrStopped()) { bool water; num = Grid.CellBelow(Grid.PosToCell(smi.transform.GetPosition())); num = Grid.OffsetCell(num, 0, -FishingStationGuide.GetDepthAvailable(smi.gameObject, out water)); } return(num); }; def.interactLoopCount = 1; def.rancherInteractAnim = "anim_interacts_fishingstation_kanim"; def.ranchedPreAnim = "bitehook"; def.ranchedLoopAnim = "caught_loop"; def.ranchedPstAnim = "trapped_pre"; def.synchronizeBuilding = true; Prioritizable.AddRef(go); AddGuide(go: go.GetComponent <Building>().Def.BuildingPreview, preview: true, occupy_tiles: false); AddGuide(go: go.GetComponent <Building>().Def.BuildingPreview, foundament: true); AddGuide(go: go.GetComponent <Building>().Def.BuildingUnderConstruction, preview: true, occupy_tiles: true); AddGuide(go: go.GetComponent <Building>().Def.BuildingUnderConstruction, foundament: true); AddGuide(go: go.GetComponent <Building>().Def.BuildingComplete, preview: false, occupy_tiles: true); }
private void OnCopySettings(object data) { GameObject gameObject = (GameObject)data; if (gameObject != null) { ButcherStation component = gameObject.GetComponent <ButcherStation>(); if (component != null) { creatureLimit = component.creatureLimit; ageButchThresold = component.ageButchThresold; } } }
public override void DoPostConfigureComplete(GameObject go) { var def = go.AddOrGetDef <RanchStation.Def>(); def.isCreatureEligibleToBeRanchedCb = delegate(GameObject creature_go, RanchStation.Instance ranch_station_smi) { var butcherStation = ranch_station_smi.GetComponent <ButcherStation>(); return(butcherStation?.IsCreatureEligibleToBeButched(creature_go) ?? false); }; def.onRanchCompleteCb = delegate(GameObject creature_go) { ButcherStation.ButchCreature(creature_go); }; def.getTargetRanchCell = delegate(RanchStation.Instance smi) { int num = Grid.InvalidCell; if (!smi.IsNullOrStopped()) { num = Grid.PosToCell(smi.transform.GetPosition()); var targetRanchable = smi.targetRanchable; if (!targetRanchable.IsNullOrStopped()) { if (targetRanchable.HasTag(GameTags.Creatures.Flyer)) { num = Grid.CellAbove(num); if (targetRanchable.HasTag(MooConfig.ID)) { num = Grid.CellLeft(num); } } } } return(num); }; def.interactLoopCount = 2; def.rancherInteractAnim = "anim_interacts_shearingstation_kanim"; def.ranchedPreAnim = "grooming_pre"; //def.ranchedLoopAnim = "grooming_loop"; def.ranchedLoopAnim = "hit"; def.ranchedPstAnim = "grooming_pst"; def.synchronizeBuilding = true; Prioritizable.AddRef(go); }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.CreatureRelocator, false); Storage storage = go.AddOrGet <Storage>(); storage.allowItemRemoval = false; storage.showDescriptor = false; storage.storageFilters = new List <Tag> { ButcherStation.ButcherableCreature }; storage.allowSettingOnlyFetchMarkedItems = false; go.AddOrGet <TreeFilterable>(); ButcherStation butcherStation = go.AddOrGet <ButcherStation>(); butcherStation.creatureEligibleTag = ButcherStation.ButcherableCreature; go.AddOrGet <LoopingSounds>(); go.AddOrGet <BuildingComplete>().isManuallyOperated = true; go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.RanchStation, false); RoomTracker roomTracker = go.AddOrGet <RoomTracker>(); roomTracker.requiredRoomType = Db.Get().RoomTypes.CreaturePen.Id; roomTracker.requirement = RoomTracker.Requirement.Required; }
public override void ClearTarget() => target = null;
public override void SetTarget(GameObject target) { this.target = target?.GetComponent <ButcherStation>(); UpdateScreen(); }