Skip to content

Commit

Permalink
+ added level namespace export level.spawn_item(section, position, le…
Browse files Browse the repository at this point in the history
…vel_vertex_id, parent_id, (bool)return_item)
  • Loading branch information
revolucas authored and Xottab-DUTY committed Aug 19, 2017
1 parent f4319cf commit 3ee7401
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/xrGame/level_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "pch_script.h"
#include "Level.h"
#include "actor.h"
#include "Actor.h"
#include "script_game_object.h"
#include "xrAICore/Navigation/PatrolPath/patrol_path_storage.h"
#include "xrServer.h"
Expand Down Expand Up @@ -595,6 +595,12 @@ void g_send(NET_Packet& P, bool bReliable = false, bool bSequential = true, bool
Level().Send(P, net_flags(bReliable, bSequential, bHighPriority, bSendImmediately));
}

//can spawn entities like bolts, phantoms, ammo, etc. which normally crash when using alife():create()
void spawn_section(pcstr sSection, Fvector3 vPosition, u32 LevelVertexID, u16 ParentID, bool bReturnItem)
{
Level().spawn_item(sSection, vPosition, LevelVertexID, ParentID, bReturnItem);
}

//ability to get the target game_object at crosshair
CScriptGameObject* g_get_target_obj()
{
Expand All @@ -616,7 +622,7 @@ float g_get_target_dist()
return 0.f;
}

//Alundaio: END
//-Alundaio

IC static void CLevel_Export(lua_State* luaState)
{
Expand All @@ -630,8 +636,9 @@ IC static void CLevel_Export(lua_State* luaState)
//Alundaio: Extend level namespace exports
def("send", &g_send) , //allow the ability to send netpacket to level
//def("ray_pick",g_ray_pick),
def("get_target_obj", &g_get_target_obj) , //intentionally named to what is in xray extensions
def("get_target_dist", &g_get_target_dist) ,
def("get_target_obj", &g_get_target_obj), //intentionally named to what is in xray extensions
def("get_target_dist", &g_get_target_dist),
def("spawn_item", &spawn_section),
//Alundaio: END
// obsolete\deprecated
def("object_by_id", get_object_by_id),
Expand Down

0 comments on commit 3ee7401

Please sign in to comment.