forked from Simnation/Main
edit
This commit is contained in:
parent
2d5b44dac7
commit
cf94f76da1
2 changed files with 38 additions and 23 deletions
|
@ -114,34 +114,47 @@ Citizen.CreateThread(function()
|
||||||
Citizen.Wait(500)
|
Citizen.Wait(500)
|
||||||
else
|
else
|
||||||
local pos = GetEntityCoords(ped)
|
local pos = GetEntityCoords(ped)
|
||||||
local forwardVector = GetEntityForwardVector(ped)
|
local heading = GetEntityHeading(ped)
|
||||||
local c = Config.Flashlight.color
|
local c = Config.Flashlight.color
|
||||||
|
|
||||||
-- Berechne die Zielposition für das Licht (weiter vorne)
|
-- Berechne die Position für den Lichtkegel auf dem Boden vor dem Spieler
|
||||||
local targetPos = vector3(
|
-- Konvertiere Heading in Radiant und berechne die Richtung
|
||||||
pos.x + forwardVector.x * 10.0,
|
local headingRad = math.rad(heading)
|
||||||
pos.y + forwardVector.y * 10.0,
|
local forwardX = -math.sin(headingRad)
|
||||||
pos.z + forwardVector.z * 10.0
|
local forwardY = math.cos(headingRad)
|
||||||
|
|
||||||
|
-- Position auf dem Boden vor dem Spieler
|
||||||
|
local groundPos = vector3(
|
||||||
|
pos.x + forwardX * 3.0, -- 3 Meter vor dem Spieler
|
||||||
|
pos.y + forwardY * 3.0,
|
||||||
|
pos.z - 0.95 -- Auf Bodenhöhe (etwas unter Spielerhöhe)
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Zeichne das Licht mit DrawSpotlightWithShadow für bessere Sichtbarkeit
|
-- Zeichne einen nach unten gerichteten Lichtkegel
|
||||||
DrawSpotlightWithShadow(
|
DrawSpotLightWithRange(
|
||||||
pos.x, pos.y, pos.z + 1.0, -- Startposition (über dem Kopf)
|
pos.x, pos.y, pos.z + 0.5, -- Lichtquelle etwas über dem Kopf
|
||||||
forwardVector.x, forwardVector.y, forwardVector.z, -- Richtung
|
0.0, 0.0, -1.0, -- Richtung nach unten
|
||||||
|
c.r, c.g, c.b, -- Farbe
|
||||||
|
10.0, -- Reichweite
|
||||||
|
Config.Flashlight.intensity, -- Intensität
|
||||||
|
1.0, 0.0 -- Innerer und äußerer Kegel
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Zeichne einen Lichtkegel in Blickrichtung auf den Boden
|
||||||
|
DrawSpotLightWithRange(
|
||||||
|
pos.x, pos.y, pos.z + 0.5, -- Lichtquelle etwas über dem Kopf
|
||||||
|
forwardX, forwardY, -0.5, -- Richtung nach vorne und leicht nach unten
|
||||||
c.r, c.g, c.b, -- Farbe
|
c.r, c.g, c.b, -- Farbe
|
||||||
Config.Flashlight.range, -- Reichweite
|
Config.Flashlight.range, -- Reichweite
|
||||||
Config.Flashlight.intensity, -- Helligkeit
|
Config.Flashlight.intensity, -- Intensität
|
||||||
Config.Flashlight.range / 2, -- Radius
|
0.5, 0.2 -- Innerer und äußerer Kegel
|
||||||
Config.Flashlight.range * 1.5, -- Falloff
|
|
||||||
0.0, -- Rundheit
|
|
||||||
GetHashKey("FLASH_TORCH_LIGHT") -- Shadow ID
|
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Zusätzlich einen helleren Punkt am Ziel zeichnen
|
-- Zusätzlich einen hellen Fleck auf dem Boden zeichnen
|
||||||
DrawLightWithRange(
|
DrawLightWithRange(
|
||||||
targetPos.x, targetPos.y, targetPos.z,
|
groundPos.x, groundPos.y, groundPos.z + 0.1, -- Leicht über dem Boden
|
||||||
c.r, c.g, c.b,
|
c.r, c.g, c.b,
|
||||||
3.0, -- Radius
|
2.0, -- Radius
|
||||||
Config.Flashlight.intensity / 2 -- Intensität
|
Config.Flashlight.intensity / 2 -- Intensität
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -153,6 +166,7 @@ Citizen.CreateThread(function()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
-- Funktion zum Aktivieren der Helm-Lampe
|
-- Funktion zum Aktivieren der Helm-Lampe
|
||||||
local function ToggleHelmetFlashlight()
|
local function ToggleHelmetFlashlight()
|
||||||
local ped = PlayerPedId()
|
local ped = PlayerPedId()
|
||||||
|
|
|
@ -43,11 +43,12 @@ Config.Glasses = {
|
||||||
-- Flashlight configuration
|
-- Flashlight configuration
|
||||||
Config.Flashlight = {
|
Config.Flashlight = {
|
||||||
color = {r = 255, g = 255, b = 255}, -- Farbe des Lichts (weiß)
|
color = {r = 255, g = 255, b = 255}, -- Farbe des Lichts (weiß)
|
||||||
range = 50.0, -- Erhöhte Reichweite des Lichts
|
range = 15.0, -- Reichweite des Lichts (reduziert für realistischeren Effekt)
|
||||||
intensity = 15.0, -- Erhöhte Intensität des Lichts
|
intensity = 10.0, -- Intensität des Lichts
|
||||||
offset = {x = 0.0, y = 0.3, z = 0.0} -- Position des Lichts relativ zum Kopf
|
offset = {x = 0.0, y = 0.3, z = 0.0} -- Position des Lichts relativ zum Kopf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-- Helm-Konfiguration für die Lampe
|
-- Helm-Konfiguration für die Lampe
|
||||||
Config.FlashlightHelmet = {
|
Config.FlashlightHelmet = {
|
||||||
male = {
|
male = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue