Beispiel #1
0
        public override void Process(ConstructorBeginCrafting packet)
        {
            GameObject gameObject = NitroxEntity.RequireObjectFrom(packet.ConstructorId);
            Crafter    crafter    = gameObject.RequireComponentInChildren <Crafter>(true);

            crafter.ReflectionCall("OnCraftingBegin", false, false, new object[] { packet.VehicleModel.TechType.ToUnity(), packet.Duration });

            vehicles.AddVehicle(packet.VehicleModel);

            Optional <object> opConstructedObject = Get(TransientObjectType.CONSTRUCTOR_INPUT_CRAFTED_GAMEOBJECT);

            if (opConstructedObject.HasValue)
            {
                GameObject constructedObject = (GameObject)opConstructedObject.Value;
                NitroxEntity.SetNewId(constructedObject, packet.VehicleModel.Id);
                VehicleChildObjectIdentifierHelper.SetInteractiveChildrenIds(constructedObject, packet.VehicleModel.InteractiveChildIdentifiers);
            }
            else
            {
                Log.Error($"Could not find constructed object {packet.VehicleModel.Id} from constructor {packet.ConstructorId}");
            }
        }