@@ -36,6 +36,7 @@ std::map<std::string, UFont*> fonts;
3636bool isFlying = false ;
3737bool godMode = false ;
3838bool creativeMode = false ;
39+ bool ignoreBuildRestriction = false ;
3940
4041bool unlockAllSchematicsConfirmation = false ;
4142
@@ -287,6 +288,11 @@ void OnDrawHUD(SML::ModReturns* returns, void* hudptr) {
287288}
288289*/
289290
291+ void CanConstructHologram (SML::ModReturns* returns, void * hologram) {
292+ returns->ReturnValue = &ignoreBuildRestriction;
293+ returns->UseOriginalFunction = !ignoreBuildRestriction;
294+ }
295+
290296// / Item helper functions
291297
292298FInventoryStack MakeItemStack (const std::string& itemname, const int & amount) {
@@ -303,6 +309,17 @@ FInventoryStack MakeItemStack(const std::string& itemname, const int& amount) {
303309
304310// / Commands
305311
312+ void IgnoreBuildRestriction (void * player, SML::CommandParser::CommandData data) {
313+ if (ignoreBuildRestriction) {
314+ sendMessage (L" Enabled build restriction!" );
315+ }
316+ else {
317+ sendMessage (L" Disabled build restriction!" );
318+ }
319+
320+ ignoreBuildRestriction = !ignoreBuildRestriction;
321+ }
322+
306323void UnlockAllSchematics (void * player, SML::CommandParser::CommandData data) {
307324 if (!unlockAllSchematicsConfirmation) {
308325 sendMessage (L" You cannot undo this action! Type '/unlockall' to confirm it" );
@@ -460,13 +477,14 @@ void Help(void* player, SML::CommandParser::CommandData data) {
460477 if (Global::m_LocalPlayer->PlayerController == nullptr || Global::m_LocalPlayer->PlayerController ->Character == nullptr )
461478 return ;
462479
463- sendMessage (L" /give <item> <amount> (WIP)" );
464- sendMessage (L" /fly" );
465- sendMessage (L" /flyspeed <speed>" );
466- sendMessage (L" /god" );
467- sendMessage (L" /settimedilation <dilation>" );
468- sendMessage (L" /creative" );
469- sendMessage (L" /unlockall" );
480+ sendMessage (L" - /give <item> <amount> (WIP)" );
481+ sendMessage (L" - /fly" );
482+ sendMessage (L" - /flyspeed <speed>" );
483+ sendMessage (L" - /god" );
484+ sendMessage (L" - /settimedilation <dilation>" );
485+ sendMessage (L" - /creative" );
486+ sendMessage (L" - /unlockall" );
487+ sendMessage (L" - /togglebuildrestriction" );
470488}
471489
472490// / World Tick
@@ -580,6 +598,7 @@ void ExampleMod::Setup() {
580598 _dispatcher.subscribe (SML::HookLoader::Event::WorldTick, Tick);
581599 _dispatcher.subscribe (SML::HookLoader::Event::UFGHealthComponentTakeDamage, OnTakeDamage);
582600 _dispatcher.subscribe (SML::HookLoader::Event::UPlayerInputInputKey, OnKeyInput);
601+ _dispatcher.subscribe (SML::HookLoader::Event::CanConstructHologram, CanConstructHologram);
583602 // _dispatcher.subscribe(SML::HookLoader::Event::DrawHUD, OnDrawHUD);
584603
585604 // SDK Init
@@ -610,6 +629,7 @@ void ExampleMod::Setup() {
610629 commandSystem.RegisterCommand (" settimedilation" , SetTimeDilation);
611630 commandSystem.RegisterCommand (" creative" , Creative);
612631 commandSystem.RegisterCommand (" unlockall" , UnlockAllSchematics);
632+ commandSystem.RegisterCommand (" togglebuildrestriction" , IgnoreBuildRestriction);
613633
614634 SML::mod_info (mod->Name (), " Initializing complete!" );
615635}
0 commit comments