mirror of
https://github.com/UberGames/RPG-X2.git
synced 2025-02-07 15:31:03 +00:00
Some minor fixes...
This commit is contained in:
parent
bc4ea34bba
commit
f10493a98d
5 changed files with 129 additions and 6 deletions
|
@ -260,6 +260,7 @@
|
||||||
<ClCompile Include="lua.c" />
|
<ClCompile Include="lua.c" />
|
||||||
<ClCompile Include="luac.c" />
|
<ClCompile Include="luac.c" />
|
||||||
<ClCompile Include="lua_cinematic.c" />
|
<ClCompile Include="lua_cinematic.c" />
|
||||||
|
<ClCompile Include="lua_cvar.c" />
|
||||||
<ClCompile Include="lua_game.c" />
|
<ClCompile Include="lua_game.c" />
|
||||||
<ClCompile Include="lua_entity.c" />
|
<ClCompile Include="lua_entity.c" />
|
||||||
<ClCompile Include="g_active.c">
|
<ClCompile Include="g_active.c">
|
||||||
|
|
|
@ -273,6 +273,9 @@
|
||||||
<ClCompile Include="lua_trace.c">
|
<ClCompile Include="lua_trace.c">
|
||||||
<Filter>Source Files\lua</Filter>
|
<Filter>Source Files\lua</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="lua_cvar.c">
|
||||||
|
<Filter>Source Files\lua</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="ai_chat.h">
|
<ClInclude Include="ai_chat.h">
|
||||||
|
|
|
@ -2552,6 +2552,113 @@ static int Entity_SetTargetShaderNewName(lua_State *L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int Entity_GetTargetEnt(lua_State *L) {
|
||||||
|
lent_t *lent;
|
||||||
|
|
||||||
|
lent = Lua_GetEntity(L, 1);
|
||||||
|
if(!lent || !lent->e)
|
||||||
|
lua_pushnil(L);
|
||||||
|
else
|
||||||
|
Lua_PushEntity(L, lent->e->target_ent);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int Entity_SetTargetEnt(lua_State *L) {
|
||||||
|
lent_t *lent;
|
||||||
|
lent_t *targ;
|
||||||
|
|
||||||
|
lent = Lua_GetEntity(L, 1);
|
||||||
|
if(!lent || !lent->e)
|
||||||
|
return 1;
|
||||||
|
targ = Lua_GetEntity(L, 2);
|
||||||
|
if(!targ || !targ->e)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
lent->e->target_ent = targ->e;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int Entity_GetTeam(lua_State *L) {
|
||||||
|
lent_t *lent;
|
||||||
|
|
||||||
|
lent = Lua_GetEntity(L, 1);
|
||||||
|
if(!lent || !lent->e)
|
||||||
|
lua_pushnil(L);
|
||||||
|
else
|
||||||
|
lua_pushstring(L, lent->e->team);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int Entity_SetTeam(lua_State *L) {
|
||||||
|
lent_t *lent;
|
||||||
|
|
||||||
|
lent = Lua_GetEntity(L, 1);
|
||||||
|
if(!lent || !lent->e)
|
||||||
|
return 1;
|
||||||
|
lent->e->team = (char *)luaL_checkstring(L, 2);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int Entity_GetTeamchain(lua_State *L) {
|
||||||
|
lent_t *lent;
|
||||||
|
|
||||||
|
lent = Lua_GetEntity(L, 1);
|
||||||
|
if(!lent || !lent->e)
|
||||||
|
lua_pushnil(L);
|
||||||
|
else
|
||||||
|
Lua_PushEntity(L, lent->e->teamchain);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int Entity_SetTeamchain(lua_State *L) {
|
||||||
|
lent_t *lent;
|
||||||
|
lent_t *team;
|
||||||
|
|
||||||
|
lent = Lua_GetEntity(L, 1);
|
||||||
|
if(!lent || !lent->e)
|
||||||
|
return 1;
|
||||||
|
team = Lua_GetEntity(L, 2);
|
||||||
|
if(!team || !team->e)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
lent->e->teamchain = team->e;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int Entity_GetTeammaster(lua_State *L) {
|
||||||
|
lent_t *lent;
|
||||||
|
|
||||||
|
lent = Lua_GetEntity(L, 1);
|
||||||
|
if(!lent || !lent->e)
|
||||||
|
lua_pushnil(L);
|
||||||
|
else
|
||||||
|
Lua_PushEntity(L, lent->e->teammaster);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int Entity_SetTeammaster(lua_State *L) {
|
||||||
|
lent_t *lent;
|
||||||
|
lent_t *team;
|
||||||
|
|
||||||
|
lent = Lua_GetEntity(L, 1);
|
||||||
|
if(!lent || !lent->e)
|
||||||
|
return 1;
|
||||||
|
team = Lua_GetEntity(L, 2);
|
||||||
|
if(!team || !team->e)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
lent->e->teammaster = team->e;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static const luaL_Reg Entity_ctor[] = {
|
static const luaL_Reg Entity_ctor[] = {
|
||||||
{"Spawn", Entity_Spawn},
|
{"Spawn", Entity_Spawn},
|
||||||
{"Find", Entity_Find},
|
{"Find", Entity_Find},
|
||||||
|
@ -2808,12 +2915,24 @@ static const luaL_Reg Entity_meta[] = {
|
||||||
{"GetTargetShaderNewName", Entity_GetTargetShaderNewName}, // args: none; return: string
|
{"GetTargetShaderNewName", Entity_GetTargetShaderNewName}, // args: none; return: string
|
||||||
{"SetTargetShaderNewName", Entity_SetTargetShaderNewName}, // args: string; return: nothing
|
{"SetTargetShaderNewName", Entity_SetTargetShaderNewName}, // args: string; return: nothing
|
||||||
|
|
||||||
|
{"GetTargetEnt", Entity_GetTargetEnt}, // args: none; return: ent
|
||||||
|
{"SetTargetEnt", Entity_SetTargetEnt}, // args: ent; return: nothing
|
||||||
|
|
||||||
|
{"GetTeam", Entity_GetTeam}, // args: none; return: string
|
||||||
|
{"SetTeam", Entity_SetTeam}, // args: string; return nothing
|
||||||
|
|
||||||
|
{"GetTeamchain", Entity_GetTeamchain}, // args: none; return: ent
|
||||||
|
{"SetTeamchain", Entity_SetTeamchain}, // args: ent; return: nothing
|
||||||
|
|
||||||
|
{"GetTeammaster", Entity_GetTeammaster},
|
||||||
|
{"SetTeammaster", Entity_SetTeammaster},
|
||||||
|
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*void dummy(gentity_t *ent) {
|
void dummy(gentity_t *ent) {
|
||||||
ent->targetShaderName;
|
ent->timestamp;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
int Luaopen_Entity(lua_State * L)
|
int Luaopen_Entity(lua_State * L)
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,17 +11,17 @@ static int Sound_PlaySound(lua_State *L) {
|
||||||
lent_t *l;
|
lent_t *l;
|
||||||
|
|
||||||
l = Lua_GetEntity(L,1);
|
l = Lua_GetEntity(L,1);
|
||||||
if(!l || !l->e) return 0;
|
if(!l || !l->e) return 1;
|
||||||
|
|
||||||
sound = (char*)luaL_checkstring(L,2);
|
sound = (char*)luaL_checkstring(L,2);
|
||||||
if(!sound[0]) return 0;
|
if(!sound[0]) return 1;
|
||||||
|
|
||||||
chan = luaL_checknumber(L,3);
|
chan = luaL_checknumber(L,3);
|
||||||
|
|
||||||
snd = G_SoundIndex(sound);
|
snd = G_SoundIndex(sound);
|
||||||
G_AddEvent(l->e, EV_SCRIPT_SOUND, snd + (chan << 8));
|
G_AddEvent(l->e, EV_SCRIPT_SOUND, snd + (chan << 8));
|
||||||
|
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const luaL_Reg lib_sound[] = {
|
static const luaL_Reg lib_sound[] = {
|
||||||
|
|
BIN
stefgame.suo
BIN
stefgame.suo
Binary file not shown.
Loading…
Reference in a new issue