Skip to content

Commit

Permalink
Variable Npcs
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverpechey committed Jul 28, 2023
1 parent 58a2d75 commit 07c36cf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion FLHookSDK
12 changes: 10 additions & 2 deletions plugins/wave_defence/WaveDefence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,14 @@ namespace Plugins::WaveDefence
game.spawnedNpcs.push_back(global->communicator->CreateNpc(npc, game.system.positionVector, rotation, game.system.systemId, true));
}

for (uint multiple = 0; multiple < global->config->npcMultiplier; multiple++)
{
for (auto const& npc : wave.variableNpcs)
{
game.spawnedNpcs.push_back(global->communicator->CreateNpc(npc, game.system.positionVector, rotation, game.system.systemId, true));
}
}

// Actions for all players in group
for (auto const& player : game.members)
{
Expand Down Expand Up @@ -433,9 +441,9 @@ DefaultDllMainSettings(LoadSettings);
REFL_AUTO(type(CostumeStrings), field(body), field(head), field(lefthand), field(righthand), field(accessory));
REFL_AUTO(type(Character), field(voice), field(infocard), field(costumeStrings));
REFL_AUTO(type(VoiceLine), field(voiceLineString), field(character));
REFL_AUTO(type(Wave), field(npcs), field(reward), field(startVoiceLine), field(endVoiceLine));
REFL_AUTO(type(Wave), field(npcs), field(variableNpcs), field(reward), field(startVoiceLine), field(endVoiceLine));
REFL_AUTO(type(System), field(system), field(waves), field(posX), field(posY), field(posZ));
REFL_AUTO(type(Config), field(systems), field(characters), field(victoryMusic), field(failureMusic));
REFL_AUTO(type(Config), field(systems), field(characters), field(victoryMusic), field(failureMusic), field(npcMultiplier));

extern "C" EXPORT void ExportPluginInfo(PluginInfo* pi)
{
Expand Down
4 changes: 4 additions & 0 deletions plugins/wave_defence/WaveDefence.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ namespace Plugins::WaveDefence
struct Wave : Reflectable
{
std::vector<std::wstring> npcs = {{L"example"}, {L"example"}};
std::vector<std::wstring> variableNpcs = {{L"example"}, {L"example"}};
uint reward = 1000;
VoiceLine startVoiceLine = VoiceLine();
VoiceLine endVoiceLine = VoiceLine();
Expand Down Expand Up @@ -90,6 +91,9 @@ namespace Plugins::WaveDefence
pub::Audio::Tryptich victoryMusicId;
pub::Audio::Tryptich failureMusicId;

// How many variable npcs per player
uint npcMultiplier = 2;

//! The config file we load out of
std::string File() override { return "config/wave_defence.json"; }
};
Expand Down

0 comments on commit 07c36cf

Please sign in to comment.