core.plugins.tesla_charger.entities.cityrp_tesla_homecharger.init
Tesla Homecharger (server)
Server logic for the player-owned Tesla Homecharger. Charges the driver of a nearby electric vehicle per 10% of charge; the charger's owner receives the profit above the base cost, and covers the shortfall when the price is set below base (including free charging). Every charger is driven by a single shared scan timer rather than a per-entity Think.
- ServerENT:ChargePlayerVehicle(ply, veh) → booleanSource ☍
-
Charges one 10% increment into a vehicle, billing the driver and paying the owner. Asks for consent on first approach, refuses when the vehicle is full, the driver cannot pay, or a below-base price would put the owner out of pocket.
Parameters
Returns
- booleanWhether charge was actually added this tick.
- ServerENT:IsValidChargingCandidate(veh) → booleanSource ☍
-
Whether a vehicle is an electric one with a live, permitted driver at the wheel.
Parameters
- vehEntityThe vehicle to test.
Returns
- boolean
- ServerENT:SetChargingActive(active)Source ☍
-
Matches the hum to whether this charger is currently servicing a vehicle.
Parameters
- activebooleanWhether a vehicle is charging in range.
- ServerENT:StartChargingHum()Source ☍
-
Starts the charging hum, creating the looping sound on first use.
- ServerENT:StopChargingHum()Source ☍
-
Stops the charging hum if one is playing.