Skip to content

Add Glide vehicle support - #301

Open
JoshPiper wants to merge 11 commits into
developmentfrom
glide
Open

JoshPiper wants to merge 11 commits into
developmentfrom
glide

Conversation

@JoshPiper

Copy link
Copy Markdown
Member

Photon support for Glide vehicles at minimum-viable scope: Photon treats a Glide car the way it treats a stock car. Glide still draws its own light and siren sprites; suppressing or sharing them is out of scope here and tracked in #292.

Supersedes #300. This carries livkx's compatibility layer and fixes from that PR, without the Glide native-lighting integration.

Changes

Compatibility layer (livkx, from #294)

  • shared/sh_glide.lua adds helpers for seat-to-chassis resolution, driver lookup, Vehicles-list lookup and the forward axis (Glide is +X forward, stock vehicles are +Y). Call sites that assumed ply:GetVehicle() is the car now go through them.

Driver seat only

  • Every Glide seat is parented to the chassis, so passengers resolved to the car. They could work the lights, siren, signals, livery and unit number, and a passenger getting out ran the driver-left path, turning off running lights and the siren. Photon.GetPlayerVehicle now returns the chassis only from Glide seat 1, and the enter and leave hooks ignore passenger seats.
  • The Glide_CanSwitchSeat block is removed: leaving the driver's seat for another seat now counts as getting out.

Brake and reverse

  • Photon's server SetupCar defined IsBraking/IsReversing on the entity. That replaced Glide's own methods, which Glide's lights and trailers read back through the entity table. Photon now leaves them alone and reads Glide's networked brake and gear state on both realms. This drops the key-press heuristic, which broke when Glide's controls were rebound.

Vehicle identity

  • A Glide chassis takes a Photon pack only from VehicleTable, PhotonVehicleName, or a VehicleName that names a Vehicles entry. Class and chassis-model guesses are off, so cars spawned from Glide's own menu stay civilian. PhotonVehicleName takes priority, so a gamemode can keep VehicleName for its own use; CityRP stores an item id there.
  • Pack authors need a unique Vehicles key; keying by the Glide class alone no longer attaches. docs/glide-vehicles.md covers this.

Fixes from #300

  • On the client, a Glide car spawned within view never received its Photon state, because NetworkEntityCreated fires before the entity's own fields exist. IsGlideVehicle now falls back to the class definition.
  • Refreshing a vehicle file no longer changes prop scale, and sprites no longer flip yaw on pitched or rolled mounts. This one is not Glide-specific.
  • Guards for a missing auto-skin index, for vehicles with no EMV sequences, and for CAR_* methods on ELS-only vehicles.

Not included

  • Glide-owned lighting from Add Glide Support #300: native light rendering in place of Photon's, ELS headlight flash, blackout mapped onto Glide headlights, and Photon writing Glide's turn signals.
  • Photon's blackout key and Glide's headlight key both default to H.

Testing

  • New and ported GLuaTest cases in lua/tests/photon/glide_helpers.lua (seat resolution, identity lookup, class-definition fallback) and lua/tests/photon/auto_component_transform.lua. These have not been run locally.
  • Not yet verified in game: a driver and a passenger getting in and out with lights and siren running; brake and reverse lights as another player sees them; Photon keybinds with Glide's controls rebound; a Glide car spawned within view of another player.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JQSMwzfwMbz3srta43yhsE


Generated by Claude Code

livkx and others added 10 commits October 10, 2026 19:03
Every Glide seat is parented to the chassis, so GetPlayerVehicle resolved
passengers to it too. A passenger could work the lights, siren, signals,
livery and unit number, and a passenger getting out ran the driver-left
path, turning off running, brake and reverse lights and the siren while
the driver was still driving.

GetPlayerVehicle now resolves to the chassis only from Glide seat 1, and
hands passengers their seat back, like a passenger pod on a stock
vehicle. The enter and leave hooks ignore Glide passenger seats.

With that in place the Glide_CanSwitchSeat block is no longer needed:
leaving the driver's seat for another one behaves like getting out, so
drop it rather than stop drivers switching seats.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQSMwzfwMbz3srta43yhsE
Photon's server SetupCar defined IsBraking and IsReversing on the entity.
Glide defines methods of the same name and reads them back through the
entity table for its own brake and reverse lights and for trailers, so on
the server Glide ran Photon's key-press guess instead of its own brake
input and gear.

Skip those definitions on Glide chassis so the server scan reads Glide's
own methods. On the client, read them directly for every Glide vehicle:
both are built on Glide's networked state, so there is no need for the
key guess or the half-second SimpleNet cache. This also drops the
forward-plus-back key special case, which broke when Glide's controls
were rebound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQSMwzfwMbz3srta43yhsE
Ported from livkx's dev/livkx/glide (a71ce15, 03be085) without the Glide
native lighting work in the same commits.

- Photon_GetAutoSkinData and AutoLivery.ApplyTexture no longer pass a nil
  submaterial index when a model has no skin/carpaint material, which is
  common on Glide packs with no livery options.
- ELS-only vehicles never run Photon:SetupCar, so ELS_Blackout and the
  enter and leave hooks check the CAR_* methods exist before calling them.

Co-Authored-By: livkx <15910716+livkx@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQSMwzfwMbz3srta43yhsE
On the client, NetworkEntityCreated fires before a scripted entity's
IsGlideVehicle and Base can be read. IsPhotonChassis was false at that
moment, so RequestSync skipped the car, and a Glide chassis spawned in
view never received its Photon state: no lights, no controls (seen on
CityRP's SWAT Bearcat; a manual resync fixed it). IsGlideVehicle now
falls back to the class definition, which is registered by then.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 886c466)
…fresh

Lua refresh stacked SetModelScale on a leftover RenderMultiply matrix, so saving a vehicle file changed prop size until respawn, and Matrix:GetAngles() could flip sprite yaw on pitched or rolled mounts.

Co-authored-by: Cursor <cursoragent@cursor.com>
(cherry picked from commit 749a077)
Ported from livkx's dev/livkx/glide (b2b995c) without the Glide vehicle
identity changes in the same commit.

EMVU.Helper and PhotonHUD:GetCurrentState indexed EMVU.Sequences[name]
directly, so a vehicle with no sequences registered yet threw instead of
reporting nothing.

Co-Authored-By: livkx <15910716+livkx@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQSMwzfwMbz3srta43yhsE
Ported from livkx's dev/livkx/glide (03be085, b2b995c, a1fa4c9) without
the Glide native lighting work in the same commits.

Glide's own spawn menu sets no VehicleName, so Photon fell back to the
chassis class and model and attached a pack to every civilian spawn that
shared them. CityRP also keeps an item id in VehicleName, which hit the
same fallback.

LookupVehiclesEntry now resolves a Glide chassis only from VehicleTable,
PhotonVehicleName, or a VehicleName that names a Vehicles entry.
PhotonVehicleName comes first, so a gamemode can keep VehicleName for its
own use and still name a pack; when it is set but does not resolve,
nothing attaches. RecoverVehicleName and the client class fallback no
longer guess for Glide.

Differences from the original: RecoverVehicleName returns false for Glide
outright, since the lookup it repeated had already failed and its only new
outcome was overwriting VehicleName. HasExplicitVehicleIdentity is left
out because nothing calls it.

Co-Authored-By: livkx <15910716+livkx@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQSMwzfwMbz3srta43yhsE
Ported from livkx's dev/livkx/glide (a71ce15, 009101f, cc5e94c, 03be085)
onto the glide branch, keeping glide's driver-seat, brake/reverse and
vehicle identity behaviour.

- Photon no longer draws its own headlight, running, brake, reverse or
  signal sprites on a Glide chassis; Glide's native lights draw them.
  Emergency props and components still render as usual.
- Photon's blackout mirrors Glide's HeadlightState, including Glide's
  auto-headlights. Photon's blackout key is ignored on Glide, because
  Glide's headlight bind is also H by default; an explicit ELS blackout
  still turns Glide's lights off.
- Photon's turn signals and hazards are written to Glide's
  TurnSignalState.
- When the active primary sequence asks for headlights (Headlights or
  GlideHeadlights on the sequence, or a "headlight" component), Photon
  flashes Glide's beams from a 0.1-second server scan and restores the
  driver's preferred beam afterwards.
- The HUD blackout icon follows Glide's headlight state.

This is an interim integration until the base-mode work in #292 replaces
it.

Co-Authored-By: livkx <15910716+livkx@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQSMwzfwMbz3srta43yhsE

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants