add ghost proximity transparency + cv
This commit is contained in:
parent
418f9b01f7
commit
d9df5d6940
36
ghost.lua
36
ghost.lua
@ -35,6 +35,8 @@ local mapChecksum = lb_map_checksum
|
|||||||
local Transmitter = lb_transmitter
|
local Transmitter = lb_transmitter
|
||||||
local Reciever = lb_reciever
|
local Reciever = lb_reciever
|
||||||
|
|
||||||
|
local Player
|
||||||
|
|
||||||
local Client
|
local Client
|
||||||
local Server
|
local Server
|
||||||
|
|
||||||
@ -174,6 +176,24 @@ local function GhostTable(header)
|
|||||||
return t
|
return t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local transProximity = 150
|
||||||
|
local function calcTrans(mobj)
|
||||||
|
local dist = R_PointToDist2(mobj.x, mobj.y, Player.mo.x, Player.mo.y)
|
||||||
|
local i = dist / transProximity
|
||||||
|
local tr = 9 - min(9, FixedInt(i * 9))
|
||||||
|
return tr << FF_TRANSSHIFT
|
||||||
|
end
|
||||||
|
|
||||||
|
CV_RegisterVar({
|
||||||
|
name = "lb_ghost_trans_prox",
|
||||||
|
defaultvalue = 150,
|
||||||
|
flags = CV_CALL,
|
||||||
|
PossibleValue = CV_NATURAL,
|
||||||
|
func = function(cv)
|
||||||
|
transProximity = cv.value
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
local function ghost_think(mobj)
|
local function ghost_think(mobj)
|
||||||
if mobj.done then return end
|
if mobj.done then return end
|
||||||
if leveltime < 1 then return end
|
if leveltime < 1 then return end
|
||||||
@ -186,7 +206,6 @@ local function ghost_think(mobj)
|
|||||||
local ghost = Ghosts:getData(mobj.playerName)
|
local ghost = Ghosts:getData(mobj.playerName)
|
||||||
local frame = ghost:frame(leveltime)
|
local frame = ghost:frame(leveltime)
|
||||||
if frame == nil then
|
if frame == nil then
|
||||||
--ghost.flags = $ | MF_NOTHINK
|
|
||||||
mobj.done = true
|
mobj.done = true
|
||||||
mobj.state = S_KART_STND1
|
mobj.state = S_KART_STND1
|
||||||
mobj.momx, mobj.momy = ghost:thrust(leveltime-1)
|
mobj.momx, mobj.momy = ghost:thrust(leveltime-1)
|
||||||
@ -196,14 +215,10 @@ local function ghost_think(mobj)
|
|||||||
P_MoveOrigin(mobj, frame.x, frame.y, frame.z)
|
P_MoveOrigin(mobj, frame.x, frame.y, frame.z)
|
||||||
mobj.angle = frame.angle
|
mobj.angle = frame.angle
|
||||||
mobj.state = frame.state
|
mobj.state = frame.state
|
||||||
mobj.frame = mobj.frame & (~FF_TRANSMASK)
|
mobj.frame
|
||||||
mobj.frame = mobj.frame | FF_TRANS30
|
= mobj.frame
|
||||||
|
& (~FF_TRANSMASK)
|
||||||
--if leveltime < TICRATE * 10 then
|
| calcTrans(mobj)
|
||||||
-- mobj.flags2 = $ | MF2_DONTDRAW
|
|
||||||
--else
|
|
||||||
-- mobj.flags2 = $ & (~MF2_DONTDRAW)
|
|
||||||
--end
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -320,7 +335,8 @@ end
|
|||||||
addHook("ThinkFrame", function()
|
addHook("ThinkFrame", function()
|
||||||
if not Recording then return end
|
if not Recording then return end
|
||||||
|
|
||||||
local p = singlePlayer()
|
Player = singlePlayer()
|
||||||
|
local p = Player
|
||||||
if not p then
|
if not p then
|
||||||
Server:stop()
|
Server:stop()
|
||||||
Client:stop()
|
Client:stop()
|
||||||
|
Loading…
Reference in New Issue
Block a user