Skip to content

Commit 3ee7401

Browse files
revolucasXottab-DUTY
authored andcommitted
+ added level namespace export level.spawn_item(section, position, level_vertex_id, parent_id, (bool)return_item)
1 parent f4319cf commit 3ee7401

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/xrGame/level_script.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include "pch_script.h"
1010
#include "Level.h"
11-
#include "actor.h"
11+
#include "Actor.h"
1212
#include "script_game_object.h"
1313
#include "xrAICore/Navigation/PatrolPath/patrol_path_storage.h"
1414
#include "xrServer.h"
@@ -595,6 +595,12 @@ void g_send(NET_Packet& P, bool bReliable = false, bool bSequential = true, bool
595595
Level().Send(P, net_flags(bReliable, bSequential, bHighPriority, bSendImmediately));
596596
}
597597

598+
//can spawn entities like bolts, phantoms, ammo, etc. which normally crash when using alife():create()
599+
void spawn_section(pcstr sSection, Fvector3 vPosition, u32 LevelVertexID, u16 ParentID, bool bReturnItem)
600+
{
601+
Level().spawn_item(sSection, vPosition, LevelVertexID, ParentID, bReturnItem);
602+
}
603+
598604
//ability to get the target game_object at crosshair
599605
CScriptGameObject* g_get_target_obj()
600606
{
@@ -616,7 +622,7 @@ float g_get_target_dist()
616622
return 0.f;
617623
}
618624

619-
//Alundaio: END
625+
//-Alundaio
620626

621627
IC static void CLevel_Export(lua_State* luaState)
622628
{
@@ -630,8 +636,9 @@ IC static void CLevel_Export(lua_State* luaState)
630636
//Alundaio: Extend level namespace exports
631637
def("send", &g_send) , //allow the ability to send netpacket to level
632638
//def("ray_pick",g_ray_pick),
633-
def("get_target_obj", &g_get_target_obj) , //intentionally named to what is in xray extensions
634-
def("get_target_dist", &g_get_target_dist) ,
639+
def("get_target_obj", &g_get_target_obj), //intentionally named to what is in xray extensions
640+
def("get_target_dist", &g_get_target_dist),
641+
def("spawn_item", &spawn_section),
635642
//Alundaio: END
636643
// obsolete\deprecated
637644
def("object_by_id", get_object_by_id),

0 commit comments

Comments
 (0)