mirror of
https://github.com/UberGames/RPG-X2.git
synced 2025-02-08 15:51:49 +00:00
Expanded lua weapon library
This commit is contained in:
parent
a75fc81ac4
commit
bb3653a36f
5 changed files with 68 additions and 4 deletions
|
@ -4,10 +4,7 @@
|
|||
// perform the server side effects of a weapon firing
|
||||
|
||||
#include "g_local.h"
|
||||
|
||||
static float s_quadFactor;
|
||||
static vec3_t forward, right, up;
|
||||
static vec3_t muzzle;
|
||||
#include "g_weapon.h"
|
||||
|
||||
extern void G_MissileImpact( gentity_t *ent, trace_t *trace);
|
||||
|
||||
|
|
10
game/g_weapon.h
Normal file
10
game/g_weapon.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef _G_WEAPON_H
|
||||
#define _G_WEAPON_H
|
||||
|
||||
#include "g_local.h"
|
||||
|
||||
static float s_quadFactor;
|
||||
vec3_t forward, right, up;
|
||||
vec3_t muzzle;
|
||||
|
||||
#endif // _G_WEAPON_H
|
|
@ -69,10 +69,17 @@ static int Cvar_String(lua_State *L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int Cvar_rpg_phaserdmg(lua_State *L) {
|
||||
lua_pushnumber(L, rpg_phaserdmg.integer);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const luaL_Reg lib_cvar[] = {
|
||||
{"Integer", Cvar_Integer},
|
||||
{"Value", Cvar_Value},
|
||||
{"String", Cvar_String},
|
||||
{"rpg_phaserdmg", Cvar_rpg_phaserdmg},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
|
@ -4,7 +4,57 @@
|
|||
|
||||
#ifdef G_LUA
|
||||
|
||||
#include "g_weapon.h"
|
||||
|
||||
static int weapon_GetForward(lua_State *L) {
|
||||
Lua_PushVector(L, forward);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int weapon_GetRight(lua_State *L) {
|
||||
Lua_PushVector(L, right);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int weapon_GetUp(lua_State *L) {
|
||||
Lua_PushVector(L, up);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int weapon_GetMuzzle(lua_State *L) {
|
||||
Lua_PushVector(L, muzzle);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int weapon_Damage(lua_State *L) {
|
||||
gentity_t *target, *inflictor, *attacker;
|
||||
vec_t *dir, *point;
|
||||
int damage, dflags, mod;
|
||||
|
||||
target = Lua_GetEntity(L, 1)->e;
|
||||
inflictor = Lua_GetEntity(L, 2)->e;
|
||||
attacker = Lua_GetEntity(L, 3)->e;
|
||||
dir = Lua_GetVector(L, 4);
|
||||
point = Lua_GetVector(L, 5);
|
||||
damage = (int)luaL_checknumber(L, 6);
|
||||
dflags = (int)luaL_checknumber(L, 7);
|
||||
mod = (int)luaL_checknumber(L, 8);
|
||||
|
||||
G_Damage(target, inflictor, attacker, dir, point, damage, dflags, mod);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const luaL_Reg lib_weapons[] = {
|
||||
{"GetForward", weapon_GetForward},
|
||||
{"GetRight", weapon_GetRight},
|
||||
{"GetUp", weapon_GetUp},
|
||||
{"GetMuzzle", weapon_GetMuzzle},
|
||||
{"Damage", weapon_Damage},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
BIN
stefgame.suo
BIN
stefgame.suo
Binary file not shown.
Loading…
Reference in a new issue