explodeVehicle
Definition
-- @/lua/ge/extensions/core/funstuff.lua:111
local function explodeVehicle()
local vehicle = getPlayerVehicle(0)
if not vehicle then return end
local boundingBox = vehicle:getSpawnWorldOOBB()
local halfExtents = boundingBox:getHalfExtents()
-- Get vehicle's transform to convert local to world coordinates
local pos = vehicle:getPosition()
local rot = quatFromDir(vehicle:getDirectionVector(), vehicle:getDirectionVectorUp())
-- Create a point at the bottom center in local space (Z is up/down)
local localPoint = vec3(math.random()*0.25-0.125, math.random()*0.25-0.125, -halfExtents.z-0.8)
-- Convert to world space
local worldPoint = rot * localPoint + pos
local longestHalfExtent = math.max(math.max(halfExtents.x, halfExtents.y), halfExtents.z)
local vehicleSizeFactor = longestHalfExtent/3
local mass = -30000000000000
local planetRadius = 5
local command = string.format('obj:setPlanets({%f, %f, %f, %d, %f})', worldPoint.x, worldPoint.y, worldPoint.z, planetRadius, mass * vehicleSizeFactor * 1)
-- Create a job to remove the planet after 1 second
core_jobsystem.create(function(job, dtTable)
be:queueAllObjectLua(command)
if vehicle then
vehicle:queueLuaCommand("fire.explodeVehicle()")
vehicle:queueLuaCommand("beamstate.breakAllBreakgroups()")
end
local remainingTime = 0.2
while remainingTime >= 0 do
remainingTime = remainingTime - dtTable.dtSim
job.sleep(0)
end
be:queueAllObjectLua("obj:setPlanets({})")
end)
return {"hide"}
end
Callers
@/ui/modules/apps/VehicleDebug/app.js
'{{:: \'ui.apps.vehicleDebug.igniteVehicle\' | translate}}' +
'{{:: \'ui.apps.vehicleDebug.explodeVehicle\' | translate}}' +
'{{:: \'ui.apps.vehicleDebug.igniteNode\' | translate}}' +
$scope.explodeVehicle = function () {
bngApi.activeObjectLua('fire.explodeVehicle()')
}
@/lua/ge/extensions/gameplay/discover/discover_037.lua
if vehicle then
vehicle:queueLuaCommand("fire.explodeVehicle()")
vehicle:queueLuaCommand("beamstate.breakAllBreakgroups()")
@/lua/ge/extensions/core/funstuff.lua
if vehicle then
vehicle:queueLuaCommand("fire.explodeVehicle()")
vehicle:queueLuaCommand("beamstate.breakAllBreakgroups()")
@/ui/ui-vue/mockdata/inputBindings.js
"title": "ui.inputActions.gameplay.funBoom.title",
"onDown": "fire.explodeVehicle()",
"order": 45,
@/lua/vehicle/fire.lua
local function explodeVehicle()
for cid, node in pairs(flammableNodes) do