forked from Simnation/Main
edit
This commit is contained in:
parent
171b571a37
commit
f5a079935a
2 changed files with 126 additions and 75 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
-- No need for explicit import as we're using shared_scripts in fxmanifest.lua
|
||||||
|
|
||||||
local function DrawText3D(coords, text)
|
local function DrawText3D(coords, text)
|
||||||
local camCoords = GetFinalRenderedCamCoord()
|
local camCoords = GetFinalRenderedCamCoord()
|
||||||
local distance = #(coords - camCoords)
|
local distance = #(coords - camCoords)
|
||||||
|
@ -31,6 +33,37 @@ local function reqParticle(dict)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Add this function to handle rocket flight
|
||||||
|
local function launchRocket(rocketObj, targetHeight, speed)
|
||||||
|
local startCoords = GetEntityCoords(rocketObj)
|
||||||
|
local targetCoords = vector3(startCoords.x, startCoords.y, startCoords.z + targetHeight)
|
||||||
|
|
||||||
|
-- Add rocket launch particle effect
|
||||||
|
UseParticleFxAsset("core")
|
||||||
|
local effect = StartParticleFxLoopedOnEntity("ent_sht_flame", rocketObj, 0.0, 0.0, -0.2, 0.0, 0.0, 0.0, 0.5, false, false, false)
|
||||||
|
|
||||||
|
-- Add rocket sound
|
||||||
|
PlaySoundFromEntity(-1, "Jet_Explosions", rocketObj, "exile_1", true, 0)
|
||||||
|
|
||||||
|
-- Make rocket fly upward
|
||||||
|
local distance = #(targetCoords - startCoords)
|
||||||
|
local steps = math.floor(distance / speed)
|
||||||
|
local stepVector = (targetCoords - startCoords) / steps
|
||||||
|
|
||||||
|
FreezeEntityPosition(rocketObj, false)
|
||||||
|
|
||||||
|
for i = 1, steps do
|
||||||
|
local newPos = startCoords + (stepVector * i)
|
||||||
|
SetEntityCoords(rocketObj, newPos.x, newPos.y, newPos.z, false, false, false, false)
|
||||||
|
Wait(10)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Stop particle effect
|
||||||
|
StopParticleFxLooped(effect, 0)
|
||||||
|
|
||||||
|
return targetCoords
|
||||||
|
end
|
||||||
|
|
||||||
for k, v in pairs(Config.Fireworks) do
|
for k, v in pairs(Config.Fireworks) do
|
||||||
if v.command then
|
if v.command then
|
||||||
RegisterCommand(v.command, function(source, args, rawCommand)
|
RegisterCommand(v.command, function(source, args, rawCommand)
|
||||||
|
@ -60,6 +93,8 @@ RegisterNetEvent('vms_firework:startFirework', function(type)
|
||||||
FreezeEntityPosition(hasBox, true)
|
FreezeEntityPosition(hasBox, true)
|
||||||
Config.Notification(Config.Translate['YOU_PLACE_FIREWORK'], 4500, 'success')
|
Config.Notification(Config.Translate['YOU_PLACE_FIREWORK'], 4500, 'success')
|
||||||
local boxCoords = GetEntityCoords(hasBox)
|
local boxCoords = GetEntityCoords(hasBox)
|
||||||
|
|
||||||
|
-- Countdown display
|
||||||
while secondsToStart > 0 do
|
while secondsToStart > 0 do
|
||||||
secondsToStart = secondsToStart - 5
|
secondsToStart = secondsToStart - 5
|
||||||
if Config.Enable3DText then
|
if Config.Enable3DText then
|
||||||
|
@ -68,19 +103,31 @@ RegisterNetEvent('vms_firework:startFirework', function(type)
|
||||||
Citizen.Wait(0)
|
Citizen.Wait(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Handle rocket launch for firework type 1
|
||||||
|
local particleOrigin = boxCoords
|
||||||
|
if myFirework.isRocket then
|
||||||
|
-- Launch the rocket
|
||||||
|
particleOrigin = launchRocket(hasBox, myFirework.rocketHeight, myFirework.rocketSpeed)
|
||||||
|
|
||||||
|
-- Wait a moment before explosion
|
||||||
|
Citizen.Wait(500)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Load particle effects
|
||||||
for k, v in pairs(myFirework.particles) do
|
for k, v in pairs(myFirework.particles) do
|
||||||
reqParticle(v.name)
|
reqParticle(v.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Create firework effects
|
||||||
while fireworkShoots ~= 0 do
|
while fireworkShoots ~= 0 do
|
||||||
fireworkShoots = fireworkShoots - 1
|
fireworkShoots = fireworkShoots - 1
|
||||||
for k, v in pairs(myFirework.particles) do
|
for k, v in pairs(myFirework.particles) do
|
||||||
UseParticleFxAsset(v.name)
|
UseParticleFxAsset(v.name)
|
||||||
local effect = StartNetworkedParticleFxNonLoopedAtCoord(
|
local effect = StartNetworkedParticleFxNonLoopedAtCoord(
|
||||||
v.effect,
|
v.effect,
|
||||||
boxCoords.x + (v.randomizeXY == true and math.random(-10, 10) or 0.0),
|
particleOrigin.x + (v.randomizeXY == true and math.random(-10, 10) or 0.0),
|
||||||
boxCoords.y + (v.randomizeXY == true and math.random(-10, 10) or 0.0),
|
particleOrigin.y + (v.randomizeXY == true and math.random(-10, 10) or 0.0),
|
||||||
boxCoords.z + v.plusHeight,
|
particleOrigin.z + (myFirework.isRocket and 0 or v.plusHeight),
|
||||||
0.0,
|
0.0,
|
||||||
0.0,
|
0.0,
|
||||||
0.0,
|
0.0,
|
||||||
|
@ -96,6 +143,7 @@ RegisterNetEvent('vms_firework:startFirework', function(type)
|
||||||
end
|
end
|
||||||
Citizen.Wait(myFirework.timeBetweenShoots or 300)
|
Citizen.Wait(myFirework.timeBetweenShoots or 300)
|
||||||
end
|
end
|
||||||
|
|
||||||
NetworkFadeOutEntity(hasBox, true, false)
|
NetworkFadeOutEntity(hasBox, true, false)
|
||||||
if Config.Debug then
|
if Config.Debug then
|
||||||
print('Prop is removed')
|
print('Prop is removed')
|
||||||
|
|
|
@ -51,12 +51,15 @@ Config.LighterItem = 'lighter' -- Changed from 'bread' to 'lighter'
|
||||||
|
|
||||||
Config.Fireworks = {
|
Config.Fireworks = {
|
||||||
[1] = {
|
[1] = {
|
||||||
item = 'firework1',
|
item = 'firework_1',
|
||||||
itemRemovable = true,
|
itemRemovable = true,
|
||||||
command = nil, -- Removed command to only use items
|
command = nil,
|
||||||
shoots = 50,
|
shoots = 10,
|
||||||
prop = "ind_prop_firework_03",
|
prop = "ind_prop_firework_01", -- Changed to rocket prop
|
||||||
timeToStart = 5500,
|
isRocket = true, -- Add this flag to identify it as a flying rocket
|
||||||
|
rocketHeight = 50.0, -- How high the rocket should fly
|
||||||
|
rocketSpeed = 0.5, -- Speed of rocket ascent (lower is faster)
|
||||||
|
timeToStart = 2000, -- Reduced time to start for better experience
|
||||||
timeBetweenShoots = 1250,
|
timeBetweenShoots = 1250,
|
||||||
particles = {
|
particles = {
|
||||||
{name = "scr_indep_fireworks", effect = "scr_indep_firework_starburst", scale = 2.0, plusHeight = 50.0, randomizeXY = true, timeToNextShoot = 120},
|
{name = "scr_indep_fireworks", effect = "scr_indep_firework_starburst", scale = 2.0, plusHeight = 50.0, randomizeXY = true, timeToNextShoot = 120},
|
||||||
|
@ -82,7 +85,7 @@ Config.Fireworks = {
|
||||||
item = 'firework3',
|
item = 'firework3',
|
||||||
itemRemovable = true,
|
itemRemovable = true,
|
||||||
command = nil, -- Removed command to only use items
|
command = nil, -- Removed command to only use items
|
||||||
shoots = 80,
|
shoots = 100,
|
||||||
prop = "ind_prop_firework_03",
|
prop = "ind_prop_firework_03",
|
||||||
timeToStart = 5500,
|
timeToStart = 5500,
|
||||||
timeBetweenShoots = 250,
|
timeBetweenShoots = 250,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue