mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-24 06:27:24 +00:00
Add Friction Volume script
This commit is contained in:
parent
3b75ecc0b4
commit
b6fb5f8173
@ -87,6 +87,7 @@ set(DSCRIPT_SOURCES "ActivityManager.cpp"
|
|||||||
"FlameJetServer.cpp"
|
"FlameJetServer.cpp"
|
||||||
"ForceVolumeServer.cpp"
|
"ForceVolumeServer.cpp"
|
||||||
"FountainOfImagination.cpp"
|
"FountainOfImagination.cpp"
|
||||||
|
"FrictionVolume.cpp"
|
||||||
"FvBounceOverWall.cpp"
|
"FvBounceOverWall.cpp"
|
||||||
"FvBrickPuzzleServer.cpp"
|
"FvBrickPuzzleServer.cpp"
|
||||||
"FvCandle.cpp"
|
"FvCandle.cpp"
|
||||||
|
@ -170,6 +170,7 @@
|
|||||||
#include "MailBoxServer.h"
|
#include "MailBoxServer.h"
|
||||||
#include "ActMine.h"
|
#include "ActMine.h"
|
||||||
#include "FireFirstSkillonStartup.h"
|
#include "FireFirstSkillonStartup.h"
|
||||||
|
#include "FrictionVolume.h"
|
||||||
|
|
||||||
// Racing Scripts
|
// Racing Scripts
|
||||||
#include "RaceImagineCrateServer.h"
|
#include "RaceImagineCrateServer.h"
|
||||||
@ -627,6 +628,8 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
|
|||||||
script = new FvRaceSmashEggImagineServer();
|
script = new FvRaceSmashEggImagineServer();
|
||||||
else if (scriptName == "scripts\\ai\\RACING\\OBJECTS\\RACE_SMASH_SERVER.lua")
|
else if (scriptName == "scripts\\ai\\RACING\\OBJECTS\\RACE_SMASH_SERVER.lua")
|
||||||
script = new RaceSmashServer();
|
script = new RaceSmashServer();
|
||||||
|
else if (scriptName == "scripts\\02_server\\Map\\General\\L_FRICTION_VOLUME_SERVER.lua")
|
||||||
|
script = new FrictionVolume();
|
||||||
|
|
||||||
//NT:
|
//NT:
|
||||||
else if (scriptName == "scripts\\02_server\\Map\\NT\\L_NT_SENTINELWALKWAY_SERVER.lua")
|
else if (scriptName == "scripts\\02_server\\Map\\NT\\L_NT_SENTINELWALKWAY_SERVER.lua")
|
||||||
|
14
dScripts/FrictionVolume.cpp
Normal file
14
dScripts/FrictionVolume.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include "FrictionVolume.h"
|
||||||
|
#include "PhantomPhysicsComponent.h"
|
||||||
|
#include "Entity.h"
|
||||||
|
|
||||||
|
void FrictionVolume::OnStartup(Entity* self) {
|
||||||
|
auto frictionAmount = self->GetVarAs<float>(m_FrictionVariable);
|
||||||
|
if (!frictionAmount) frictionAmount = m_DefaultFriction;
|
||||||
|
auto* phanPhys = self->GetComponent<PhantomPhysicsComponent>();
|
||||||
|
if (!phanPhys) return;
|
||||||
|
|
||||||
|
phanPhys->SetPhysicsEffectActive(true);
|
||||||
|
phanPhys->SetEffectType(4); // this should be noted in a enum somewhere
|
||||||
|
phanPhys->SetDirectionalMultiplier(frictionAmount);
|
||||||
|
}
|
11
dScripts/FrictionVolume.h
Normal file
11
dScripts/FrictionVolume.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "CppScripts.h"
|
||||||
|
|
||||||
|
class FrictionVolume : public CppScripts::Script
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void OnStartup(Entity* self) override;
|
||||||
|
private:
|
||||||
|
const float m_DefaultFriction = 1.5;
|
||||||
|
const std::u16string m_FrictionVariable = u"FrictionAmt";
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user