public override void Process(FabricatorItemPickup packet) { Optional <GameObject> opGameObject = GuidHelper.GetObjectFrom(packet.FabricatorGuid); if (opGameObject.IsEmpty()) { Console.WriteLine("Could not find fabricator from guid " + packet.FabricatorGuid); return; } GameObject gameObject = opGameObject.Get(); CrafterLogic crafterLogic = gameObject.GetComponentInChildren <CrafterLogic>(true); if (crafterLogic == null) { Console.WriteLine("Game object did not have a crafterLogic component!"); return; } if (crafterLogic.numCrafted > 0) { crafterLogic.numCrafted--; if (crafterLogic.numCrafted == 0) { crafterLogic.Reset(); } } }
public override void Process(FabricatorItemPickup packet) { GameObject gameObject = NitroxIdentifier.RequireObjectFrom(packet.FabricatorId); CrafterLogic crafterLogic = gameObject.RequireComponentInChildren <CrafterLogic>(true); if (crafterLogic.numCrafted > 0) { crafterLogic.numCrafted--; if (crafterLogic.numCrafted == 0) { crafterLogic.Reset(); } } }