Repository navigation
List the server's entities, draw them on the live map and delete them a hundred at a time - #61
Merged
Merged
Conversation
…he map and the entities to share
…ttings category's loading card and page link
…ks at them, and delete them a hundred at a time
…heir own, and delete a selection of them
…too many, and open the map on one from the list
… category of their own
… and the sweeps in the README
…way, for the topics to stay within clippy's length
This was referenced Nov 11, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Seven commits, three merges of
main(#56, #57, #59) and two commits the merges called for. The bridge lists the server's vehicles, peds and objects through OneSync while a panel looks at them, and deletes the ones an account picks, a hundred at a time, with the guards of the txAdmin fork's Entity Manager. The panel gets an Entities page under Insights, an Entities layer on the live map, and a Settings category for how often the server lists them. Entities is an optional feature of its own, on by default: turned off, it runs nothing and its routes answerfeature_disabled. Observer keeps no entity: the list lives in memory.What changed
The count of who follows a live view, out of the map (
d9e2477)crates/observer-app/src/watching.rs:Watchers(join,any,subscribe) and theWatchingguard, moved out ofmap.rs.observer_app::Watchingkeeps its path.crates/observer-web/src/live/topics.rs:map_eventsbecomeswatched_events, for any view the server feeds only while someone looks.Shared panel helpers (
d97f7c8)web/src/lib/search.ts:oneOf,textanddefined, taken out ofdrops/search.tsandstatistics/search.ts.web/src/settings/Row.tsx:CategoryLoadingandCategoryLink, used byLiveMap.tsx.Bans.tsxkeeps its own copies for now: other open branches rework it.The server's side (
e620e7e)resource/observer/server.lua, in a block of its own beforeACTIONS: actionentitieswith a lease (everyMs,forMs), aspositionshas. A sweep readsGetAllVehicles,GetAllObjectsandGetAllPeds, works a millisecond at a time and gives the frame back withWait(0), stops at 50 ms of work or 20,000 rows, and spaces the next sweeps out (twice the cadence, up to 60 s) after one that took over 25 ms of work or 10 ms of listing. It reportsentitiesin parts of 500 rows or 64 KB, a row beingnetId,serial,kind,class,model,x,y,z,owner,bucket,population,resource,flags, and looks the creating resource up for 300 entities a sweep at most, sinceGetEntityScriptwalks every resource. ActiondeleteEntitiestakes net id and serial pairs, a deadline and the bridge's epoch; it refuses a player's own ped, a vehicle a player sits in, a train, an entity whose serial or model changed, and anything past the deadline; it checksDoesEntityExist250 ms later and reportsentitiesDeleted. The contract does not change: two internal reports and two actions, no event, no export.crates/observer-domain/src/entities.rs(types, filters, sort, limits),crates/observer-fxserver/src/entities.rs(the reports),crates/observer-app/src/entities.rsandentities/query.rs(the service: the lease while a topic or a page watches, the parts gathered into one list, filters, facets, pages, map points or density cells, the deletion and its audit entry),crates/observer-store/src/entities.rs(the cadence, insettings),crates/observer-web/src/api/entities.rs.GET /api/servers/default/entitiesandGET …/entities/map(ENTITIES_VIEW),POST …/entities/delete(ENTITIES_DELETE),GET …/entities/settings(SETTINGS_VIEW),PUT …/entities/settings(SETTINGS_MANAGE, with the password again). Topicserver.entities(ENTITIES_VIEW).ENTITIES_VIEW(bit 27, area Entities) andENTITIES_DELETE(bit 28, sensitive, implies the view). Audit actionsentities_deletedandentities_settings_changed. Error codesentities_not_listed,entities_changed,entities_out_of_date,entities_deleting(409),too_many_entitiesandinvalid_entities_settings(400). Featureentities, on by default.PLAYERS_MAP: both say where a player is.fake-fxserver: entities set from its console (fake_entity,fake_entities,fake_entity_gone,fake_entity_stays,fake_enter,fake_possess), and the convarsfake_entities_every_ms,fake_entities_row_usandfake_entities_list_usfor what a sweep costs.The Entities page (
7416271)web/src/pages/EntitiesPage.tsx, under Insights: the type with the map's mark, the model's hash, the net id, the creating resource, the owner, the position and the bucket. Filters by type, vehicle class, resource, owner and bucket, a search, the most common models; a sort by column, a hundred a page; filters, sort and page in the address.web/src/entities/selection.ts): an occupied vehicle and a train are never offered, and nothing is deleted from a list three sweeps old or from another run of the server.web/src/entities/DeleteDialog.tsx: what the selection holds, how many a script created or a player's game simulates, and from 20 entities the wordDELETEto type; then a notice of what became of each.web/src/components/Checkbox.tsxdraws a page that is partly selected;web/src/components/SelectField.tsxis the labelled select.The live map's layer (
d3dd8ad)web/src/entities/MapLayer.tsx: an Entities switch beside Names and Trails. The entities are drawn on one canvas under the players, a shape per kind. Past 5,000 in the part of the map in view, the API sends density cells instead, and a click on a cell zooms into it. A click on an entity opens its card, with its place in the list and a deletion.web/src/map/MapCanvas.tsxgains generic props (renderLayer,onViewport,onPress,frame) and knows nothing of entities.useTopictakesenabled, so that the server lists only while the layer is on./map?entity=<net id>.The cadence in Settings (
1784f05): Settings › Entities, every 5, 10, 15, 30 or 60 seconds (15 by default), saved with the password again, in the audit log.README (
594471a): the Entities section, the rail's groups and the feature list.Merges of
main(9a4f9e5,0ef1f3a,a842814) and what they called for (7a0cfbd,98f3eee)RESOURCES_CONTROL), so the entities' permissions moved to 27 and 28; the owner's mask incrates/observer-web/src/tests.rsis now1fffffff,Topic::ALLholds 13 topics andAuditAction::ALL117 actions. The bindings were generated again from the merged Rust. Infake-fxserver, thestopFollow the server's resources on a Resources page, and start, stop, restart or rescan them #57 wrote also drops the entity listing when the bridge stops, as the arm it replaced did.7a0cfbd: with both branches' topics,live::topics::openreached 104 lines, past clippy's 100. Every topic that sends a whole status and then follows it now opens throughfollowed(), which subscribes before it reads, as each arm did.98f3eee: the web tests of the entities gave their accounts the masks of bits 26 and 27; they give 27 and 28.README.mdandweb/src/shell/nav.tsonly; both sides kept.Why
Observer could not show what the server holds. The txAdmin fork's Entity Manager lists and deletes entities; this brings it with the fork's guards (100 at most, a word to type from 20, never a player's ped, an occupied vehicle or a train, never from a stale list, the owner hidden from who does not see the map), while the server pays for a sweep only while someone looks.
Notes for review
ServerGameState::MakeScriptHandle,include/state/Pool.h), a handle is a pool slot and a byte that each reuse of the slot increments, so a reused net id comes under another handle and gets a new serial.server.lua, a line that ends in= true,counts as an event for two contract tests; the entity block's table fields share their line.Verified
cargo xtask checkon Windows ata842814: fmt, icons, clippy with-D warningswith and withouttest-catalog, 3,402 Rust tests in 49 test binaries, none failed, bindings unchanged, and inweb/format, lint, type check, 892 tests and the build, under Node 26.13.d9e2477ande620e7e(fmt, clippy, the app and web tests, bindings unchanged), the panel at each one (format, lint, type check, tests, and the build from7416271on).npm run e2eata842814, with the binariescargo xtask e2ebuilds: 11 flows passed and 2 are skipped on Windows. A first run had stopped at the flow that checks a label on the player's profile: the Labels card did not showCHAR-1234within 30 s. It passed on the next run, and this branch touches neither players nor labels. Chromium 1248, already on this machine, was given throughPLAYWRIGHT_BROWSERS_PATH, because thenpx playwright installofcargo xtask e2ewould have downloaded 1254.crates/fake-fxserver/tests/runtime.rs: a list made only while someone looks, a deletion with each outcome and its audit entry, a server without OneSync.Not verified
GetAllVehicles,GetAllObjects,GetAllPeds,NetworkGetNetworkIdFromEntity,GetEntityModel,GetVehicleType,GetEntityPopulationType,GetEntityCoords,NetworkGetEntityOwner,GetEntityRoutingBucket,GetEntityScript,GetPlayerPedwith a string source,GetVehiclePedIsIn,NetworkGetEntityFromNetworkId,IsPedAPlayer,DeleteEntityandDoesEntityExist;os.nanotimein CfxLua;json.encodeof an empty table; what a sweep costs on a busy server; the refusal under RedM; the lease ending within a second.