Blaze The Cat
Member
I guess I can post here stuff regarding Lua, hoping maybe it will help you in the later days...
Here are Functions I made that I find handy.
Returns a distance relative from obj1 to obj2 (Must be mobj_t) in 3D space on the Fixed scale.
A further expansion of P_3DDist that not only uses that function but also thrusts the victim object away from the attacker depending on the explosion radius and thrust at maximum. Radius and Thrust use the fixed point scale, and attacker and victim are mobj_t.
Also, it would be nice if I could get some comments on a Lua me and Kitoko are working on, called the Doom Lua, which basically tries its best to recreate old DooM style damage and health systems.
Lua :http://puu.sh/p3JAu/bae9b80a0a.lua
Resource wad: http://puu.sh/p3JKN/7be0cc5d2a.zip
It currently only handles MATCH, so if you try this in Coop or Team Match, for example, it'll look weird. But, the damage is there for proof of concept.
Testing commands (Host only)
iddqd/iddqd2: Gives you 200 of armor and health, the maximum possible with hp and armor maximums of 100 plus bonuses. Will be changed to singleplayer-only with a new function once armor pickups exist.
setvital: Sets vital 1-4 to the following value, only usable on self. This command is UNSAFE and only for testing. 1:Health, 2:Max Health, 3:Armor, 4:Max Armor.
Normal commands (Works fine)
taunt: Taunting is back. Bind this to a key to annoy your friends like the old days.
painvoices: Server only. Changes the pain voices to Doomguy's if your input painvoices "doom" and normal if you set it to painvoices "normal"
Defunct commands (Exists in code, use at own risk)
svflags: Server flags. Currently incomplete, but sets the server global flags, like whether players can swim, or if they can use abilities, etc.
clflags: Client flags. Currently incomplete, but will allow the player to set specific flags on themselves, like if they run or walk, see SRB2's original scoreboard and "score", or see item-up messages.
We have yet to clean up a lot of stuff, so expect it to become more optimized later onm but at least you can have some games of Deathmatch in the meantime. Sugggestions are welcome, even if it involves weapon balance.
Here are Functions I made that I find handy.
Code:
local function P_3DDist (obj1, obj2)
return FixedSqrt(FixedMul(abs(obj1.x - obj2.x), abs(obj1.x - obj2.x)) + FixedMul(abs(obj1.y - obj2.y), abs(obj1.y - obj2.y)) + FixedMul(abs(obj1.z - obj2.z), abs(obj1.z - obj2.z)))
end
Code:
local function P_ExplosionThrust (attacker, victim, radius, thrust, instant)
if radius != nil
or thrust != nil
local xyzdist = P_3DDist(attacker, victim)
local scaleform = FixedDiv((radius - xyzdist), bombradi2)
local diffxyz = {(attacker.x - victim.x), (attacker.y - victim.y), (attacker.z - victim.z)}
local alldist = abs(diffxyz[1]) + abs(diffxyz[2]) + abs(diffxyz[3])
local thrustxyz = {}
for w=1,3 do
thrustxyz[w] = FixedMul(FixedDiv(diffxyz[w], alldist), FixedMul(thrust, scaleform))
end
if instant
victim.momx = -thrustxyz[1]
victim.momy = -thrustxyz[2]
victim.momz = -thrustxyz[3]
else
victim.momx = $1 - thrustxyz[1]
victim.momy = $1 - thrustxyz[2]
victim.momz = $1 - thrustxyz[3]
end
else
end
Also, it would be nice if I could get some comments on a Lua me and Kitoko are working on, called the Doom Lua, which basically tries its best to recreate old DooM style damage and health systems.
Lua :http://puu.sh/p3JAu/bae9b80a0a.lua
Resource wad: http://puu.sh/p3JKN/7be0cc5d2a.zip
It currently only handles MATCH, so if you try this in Coop or Team Match, for example, it'll look weird. But, the damage is there for proof of concept.
Testing commands (Host only)
iddqd/iddqd2: Gives you 200 of armor and health, the maximum possible with hp and armor maximums of 100 plus bonuses. Will be changed to singleplayer-only with a new function once armor pickups exist.
setvital: Sets vital 1-4 to the following value, only usable on self. This command is UNSAFE and only for testing. 1:Health, 2:Max Health, 3:Armor, 4:Max Armor.
Normal commands (Works fine)
taunt: Taunting is back. Bind this to a key to annoy your friends like the old days.
painvoices: Server only. Changes the pain voices to Doomguy's if your input painvoices "doom" and normal if you set it to painvoices "normal"
Defunct commands (Exists in code, use at own risk)
svflags: Server flags. Currently incomplete, but sets the server global flags, like whether players can swim, or if they can use abilities, etc.
clflags: Client flags. Currently incomplete, but will allow the player to set specific flags on themselves, like if they run or walk, see SRB2's original scoreboard and "score", or see item-up messages.
We have yet to clean up a lot of stuff, so expect it to become more optimized later onm but at least you can have some games of Deathmatch in the meantime. Sugggestions are welcome, even if it involves weapon balance.
Last edited: