Skip to content

Commit 38ce46d

Browse files
author
Brabb3l
committed
added togglebuildrestriction
1 parent 223b2e1 commit 38ce46d

File tree

3 files changed

+31
-9
lines changed

3 files changed

+31
-9
lines changed

ExampleMod.cpp

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ std::map<std::string, UFont*> fonts;
3636
bool isFlying = false;
3737
bool godMode = false;
3838
bool creativeMode = false;
39+
bool ignoreBuildRestriction = false;
3940

4041
bool 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

292298
FInventoryStack 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+
306323
void 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
}

ExampleMod.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ExampleMod : SML::BaseMod {
1515
return "UtilityMod";
1616
};
1717
const char* Version() {
18-
return "0.3.2";
18+
return "0.3.3";
1919
};
2020
const char* Description() {
2121
return "Adds several commands";

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ You can download a compiled modloader and mod version in the release tab.
44

55
## Installation
66

7-
1. Put the xinput dll under path\to\satisfactory\FactoryGame\Binaries\Win64
7+
1. Put the xinput dll in path\to\satisfactory\FactoryGame\Binaries\Win64
88
2. Create a folder named 'mods'
99
3. Put the UtilityMod dll into the mods folder
1010
4. Start the game
@@ -29,4 +29,6 @@ This mod is under development!
2929
/creative
3030
3131
/unlockall
32+
33+
/togglebuildrestriction
3234
```

0 commit comments

Comments
 (0)