// displayed when player logging into the game and has a single vehicle in garage // or when the vehicle is despawned to garage private void ClientRemote_VehicleInGarage(IProtoVehicle protoVehicle) { NotificationSystem.ClientShowNotification(protoVehicle.Name, Notification_VehicleInGarage_Description, icon: protoVehicle.Icon) .HideAfterDelay(delaySeconds: 60); }
private static void Update() { IDynamicWorldObject vehicle = null; IProtoVehicle protoVehicle = null; if (ClientHotbarSelectedItemManager.SelectedItem?.ProtoItem is IProtoItemVehicleRepairKit && ClientCurrentCharacterHelper.PublicState.CurrentPublicActionState is not VehicleRepairActionState.PublicState) { vehicle = VehicleRepairKitSystem.ClientGetObjectToRepairAtCurrentMousePosition(); protoVehicle = vehicle?.ProtoGameObject as IProtoVehicle; } if (currentTooltipVehicle != vehicle) { tooltip?.Destroy(); tooltip = null; currentTooltipVehicle = vehicle; } if (protoVehicle is null) { return; } tooltip ??= VehicleRepairKitTooltip.CreateAndAttach(vehicle); }
public ViewModelGarageVehicleEntry( uint vehicleGameObjectId, IProtoVehicle protoVehicle, VehicleStatus status) { this.VehicleGameObjectId = vehicleGameObjectId; this.ProtoVehicle = protoVehicle; this.Status = status; }
public string Execute( IProtoVehicle objTypeName, double x, double y) { var offset = Server.World.WorldBounds.Offset; return(SpawnObject(objTypeName, (x + offset.X, y + offset.Y))); }
public ViewModelGarageVehicleEntry( uint vehicleGameObjectId, IProtoVehicle protoVehicle, VehicleStatus status) { VehicleGameObjectId = vehicleGameObjectId; ProtoVehicle = protoVehicle; Status = status; UpdateName(); }
public ViewModelVehicleSchematic(IProtoVehicle protoVehicle) { this.ProtoVehicle = protoVehicle; if (protoVehicle is null) { return; } this.UpdateIsCanBuild(); this.SubscribeToContainersEvents(); }
public ViewModelGarageVehicleEntry( uint vehicleGameObjectId, IProtoVehicle protoVehicle, VehicleStatus status) { this.VehicleGameObjectId = vehicleGameObjectId; this.ProtoVehicle = protoVehicle; this.Status = status; VehicleNamesSystem.ClientVehicleNameChanged += this.VehicleNameChangedHandler; }
public static void ClientShowNotificationNotEnoughEnergy(IProtoVehicle protoVehicle) { Client.Audio.PlayOneShot(SoundResourceNoEnergy, volume: 0.4f); NotificationSystem.ClientShowNotification( string.Format(VehicleSystem.Notification_CannotUseVehicle_TitleFormat, protoVehicle.Name), Notification_EnergyDepleted_Message, color: NotificationColor.Bad, icon: protoVehicle.Icon, playSound: false); }
public static IDynamicWorldObject ClientGetObjectToRepairAtCurrentMousePosition( bool showErrorIfNoCompatibleVehicle) { var worldObjects = ClientGetObjectsAtCurrentMousePosition(); IDynamicWorldObject vehicleToRepair = null; IProtoVehicle protoVehicleIncompatible = null; // find first damaged vehicle there foreach (var worldObject in worldObjects) { if (worldObject.ProtoGameObject is not IProtoVehicle protoVehicle) { continue; } if (!protoVehicle.IsRepairable) { protoVehicleIncompatible = protoVehicle; continue; } var vehicle = (IDynamicWorldObject)worldObject; var maxStructurePointsMax = protoVehicle.SharedGetStructurePointsMax(vehicle); var structurePointsCurrent = worldObject.GetPublicState <VehiclePublicState>() .StructurePointsCurrent; if (structurePointsCurrent < maxStructurePointsMax) { vehicleToRepair = vehicle; break; } } if (vehicleToRepair is null && protoVehicleIncompatible is not null && showErrorIfNoCompatibleVehicle) { NotificationSystem.ClientShowNotification(NotificationErrorCannotRepairThisVehicle, color: NotificationColor.Bad, icon: protoVehicleIncompatible.Icon); } return(vehicleToRepair); }
private static string SpawnObject( IProtoVehicle objTypeName, Vector2D position) { var result = Server.World.CreateDynamicWorldObject(objTypeName, position); if (result is null) { return("<cannot spawn there>"); } var protoVehicle = (IProtoVehicle)result.ProtoGameObject; var byCharacter = ServerRemoteContext.IsRemoteCall ? ServerRemoteContext.Character : null; if (byCharacter is not null) { protoVehicle.ServerOnBuilt(result, byCharacter); } return(result.ToString()); }
public ProtoVehicleViewModel([NotNull] IProtoVehicle vehicle) : base(vehicle) { Description = vehicle.Description; }
public GarageVehicleEntry(IWorldObject vehicle, VehicleStatus status) { this.Id = vehicle.Id; this.ProtoVehicle = (IProtoVehicle)vehicle.ProtoGameObject; this.Status = status; }
public TechNodeEffectVehicleUnlock(IProtoVehicle vehicle) { this.Vehicle = vehicle ?? throw new ArgumentNullException(); }
/// <summary> /// Constructor for vehicle creation recipe. /// Must be used only in InitEntityRelationships phase. /// </summary> /// <param name="vehicleViewModel">View Model of IProtoVehicle.</param> /// <param name="vehicle"></param> public VehicleBuildRecipeViewModel([NotNull] ProtoVehicleViewModel vehicleViewModel, IProtoVehicle vehicle) : base(vehicleViewModel.ProtoEntity) { if (!EntityViewModelsManager.EntityDictionaryCreated) { throw new Exception("CNEI: Build constructor used before all entity VMs sets."); } InputItemsList = vehicle.BuildRequiredItems .Select(item => EntityViewModelsManager.GetEntityViewModel(item.ProtoItem)) .ToList(); InputItemsVMList = vehicle.BuildRequiredItems .Select(item => new ViewModelEntityWithCount(EntityViewModelsManager.GetEntityViewModel(item.ProtoItem), item.Count)) .ToList().AsReadOnly(); BuildRequiredElectricityAmount = vehicle.BuildRequiredElectricityAmount; OutputItemsList.Add(vehicleViewModel); VehicleVM = vehicleViewModel; StationsList = EntityViewModelsManager.GetAllEntityViewModelsByType <IProtoVehicleAssemblyBay>() .AsReadOnly(); ListedInTechNodes = vehicleViewModel.ListedInTechNodes; }
public static void ServerNotifyClientNotEnoughEnergy(ICharacter character, IProtoVehicle protoVehicle) { Instance.CallClient(character, _ => _.ClientRemote_OnNotEnoughEnergy(protoVehicle)); }
public string Execute( IProtoVehicle protoDynamicWorldObject, [CurrentCharacterIfNull] ICharacter character) { return(SpawnObject(protoDynamicWorldObject, character.TilePosition.ToVector2D())); }
private void ClientRemote_OnNotEnoughEnergy(IProtoVehicle protoVehicle) { ClientShowNotificationNotEnoughEnergy(protoVehicle); }