Repository navigation
Fix the findings from the review of #13 - #20
Conversation
- Fishing: PublishFishCaught returns Task, the net item is only taken once the net exists, net dialogs re-check the character and access - Vehicles: /park keeps the world and interior, the editor saves the live vehicle, deleting a vehicle uses a short-lived context and publishes OnVehicleDeleted, which Fishing and Radios handle - Maps: despawning skips objects that are gone, a bulk replace of an unloaded map applies its removed buildings - /government sets binding to what the menu showed; the bank fee cap prompt no longer shows a thousands separator - Docs: fishing limitation, CatchWeight and seed ids for hosts, OnVehicleDeleted, /deletevehicle notation Database: Vehicles.VirtualWorld and Interior default to 0, Vehicles.ServerVehicle defaults to false, FishLoot.LootKind, SizeClass, RequiredFishingLevel and IsNetOnly get database defaults. Hosts need a migration.
| _logger.LogError(ex, "Removing the keys of deleted vehicle {VehicleId} failed.", vehicleId); | ||
| } | ||
| RemoveVehicleFishingNet(vehicleId); | ||
| _ = _serverEventAggregator.PublishAsync(new OnVehicleDeletedEventArgs { VehicleId = vehicleId }); |
There was a problem hiding this comment.
Question: this relies on every OnVehicleDeleted handler finishing before its first await, because DestroyLoadedVehicle runs right after. The two Framework handlers are synchronous, so this works today. But a host that writes an async Task handler will find the vehicle already destroyed after its first await, and nothing in the docs tells them.
Could you add that to the OnVehicleDeleted row in docs/server-events.md (for example "The loaded vehicle is destroyed right after; a handler that awaits can't use it after its first await"), so host authors know? The other option is to make the delete async and await the publish before destroying the vehicle, but that is a bigger change.
| /// A map that was already in the game has them applied; applying them twice would count twice against the | ||
| /// player's limit. | ||
| /// </summary> | ||
| private void ApplyRemovedBuildings(Map map) |
There was a problem hiding this comment.
Small suggestion: this loop is the same as the one at the end of MapEditorService.LoadMap (foreach (MapRemovedBuilding removal in map.GetRemovedBuildings()) _mapService.ApplyRemovedBuilding(removal);). A public IMapService.ApplyRemovedBuildings(Map map) (with a /// <summary>) would let both places call one method, so a later change to how removals apply (for example the player limit this comment mentions) only has to be made once.
| /// Another admin can replace (a model change) or delete the vehicle while this editor is open, so the save looks | ||
| /// the live vehicle up again. False when the editor had a live vehicle and it's gone. | ||
| /// </summary> | ||
| private bool RefreshEditedVehicle() |
There was a problem hiding this comment.
Naming nit: Refresh… isn't in the verb list in AGENTS.md ("How code is written"), and this method both changes _component.EditedVehicle and answers a yes/no question. LoadEditedVehicle() (it looks the live vehicle up again and stores it) fits the vocabulary and still reads well as if (!LoadEditedVehicle()). See conventions.
ReviewVerdict: Ready to merge Should fix
Docs: up to date ( |
- IMapService.ApplyRemovedBuildings(Map) applies a map's removed buildings; loading a map and a bulk replace both use it - The vehicle editor's LoadEditedVehicle (was RefreshEditedVehicle) follows the verb vocabulary - Docs: OnVehicleDeleted handlers must do their work before any await, because the vehicle is destroyed right after publishing
ReviewVerdict: Ready to merge All three points from my earlier review are now fixed:
Docs: up to date ( |
Fixes the confirmed findings from Claude's review of #13. Each finding was checked against the code first; overstated ones are only documented.
Changes
PublishFishCaughtreturnsTask; the net item is only taken once the net exists; net dialogs check again that the player is still playing their character and may use the net./parksaves the virtual world and interior; the editor looks the live vehicle up again before saving and refuses if it's gone; deleting a vehicle uses a short-lived context.OnVehicleDeleted: published when a saved vehicle is deleted. Radios and Fishing clean up their own radio and net, so Vehicles no longer calls into them./governmentsets the binding to what the menu showed.CatchWeightand seed id notes for hosts,OnVehicleDeleted,/park,/deletevehicle <vehicle id>.Not fixed in code, by decision: net-only fish (25 kg+) can't leave the net; a selling point at the docks will handle them later. Documented as a known limitation.
Database
Hosts need a migration:
Vehicles.VirtualWorldandInteriordefault to 0;Vehicles.ServerVehicledefaults to false (it was true until Jurisdiction settings, map editor, fishing, vehicle editor rework, contributor docs and Claude reviews #13; vehicles saved then may be marked as server vehicles by mistake);FishLoot.LootKind,SizeClass,RequiredFishingLevelandIsNetOnlyget database defaults.No NuGet packages changed. Built with
dotnet build; not tested in game yet.