Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/items/StarTools.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-07-21 00:58:49 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-07-21 00:58:49 +1000
commit4b0bc220e4da1173f742a4973939b139bef562db (patch)
tree0ff66d5957575fa814fc10b8cd93e3dd378f45dc /source/game/items/StarTools.cpp
parent607be749451aa40e3619e7ceab0927d1fcec8233 (diff)
Support for changing the game's timescale
Context-specific (like per-world) timescales can also be added later
Diffstat (limited to 'source/game/items/StarTools.cpp')
-rw-r--r--source/game/items/StarTools.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/source/game/items/StarTools.cpp b/source/game/items/StarTools.cpp
index 178809d..2e0d994 100644
--- a/source/game/items/StarTools.cpp
+++ b/source/game/items/StarTools.cpp
@@ -118,11 +118,11 @@ void MiningTool::fire(FireMode mode, bool shifting, bool edgeTriggered) {
}
}
-void MiningTool::update(FireMode mode, bool shifting, HashSet<MoveControlType> const& moves) {
- SwingableItem::update(mode, shifting, moves);
+void MiningTool::update(float dt, FireMode mode, bool shifting, HashSet<MoveControlType> const& moves) {
+ SwingableItem::update(dt, mode, shifting, moves);
if (!ready() && !coolingDown())
- m_frameTiming = std::fmod((m_frameTiming + WorldTimestep), m_frameCycle);
+ m_frameTiming = std::fmod((m_frameTiming + dt), m_frameCycle);
else
m_frameTiming = 0;
}
@@ -200,11 +200,11 @@ void HarvestingTool::fire(FireMode mode, bool shifting, bool edgeTriggered) {
}
}
-void HarvestingTool::update(FireMode fireMode, bool shifting, HashSet<MoveControlType> const& moves) {
- SwingableItem::update(fireMode, shifting, moves);
+void HarvestingTool::update(float dt, FireMode fireMode, bool shifting, HashSet<MoveControlType> const& moves) {
+ SwingableItem::update(dt, fireMode, shifting, moves);
if (!ready() && !coolingDown())
- m_frameTiming = std::fmod((m_frameTiming + WorldTimestep), m_frameCycle);
+ m_frameTiming = std::fmod((m_frameTiming + dt), m_frameCycle);
else
m_frameTiming = 0;
}
@@ -269,9 +269,9 @@ void WireTool::init(ToolUserEntity* owner, ToolHand hand) {
m_wireConnector = 0;
}
-void WireTool::update(FireMode fireMode, bool shifting, HashSet<MoveControlType> const& moves) {
- FireableItem::update(fireMode, shifting, moves);
- BeamItem::update(fireMode, shifting, moves);
+void WireTool::update(float dt, FireMode fireMode, bool shifting, HashSet<MoveControlType> const& moves) {
+ FireableItem::update(dt, fireMode, shifting, moves);
+ BeamItem::update(dt, fireMode, shifting, moves);
}
List<Drawable> WireTool::drawables() const {
@@ -378,9 +378,9 @@ void BeamMiningTool::init(ToolUserEntity* owner, ToolHand hand) {
BeamItem::init(owner, hand);
}
-void BeamMiningTool::update(FireMode fireMode, bool shifting, HashSet<MoveControlType> const& moves) {
- FireableItem::update(fireMode, shifting, moves);
- BeamItem::update(fireMode, shifting, moves);
+void BeamMiningTool::update(float dt, FireMode fireMode, bool shifting, HashSet<MoveControlType> const& moves) {
+ FireableItem::update(dt, fireMode, shifting, moves);
+ BeamItem::update(dt, fireMode, shifting, moves);
}
List<PersistentStatusEffect> BeamMiningTool::statusEffects() const {
@@ -567,11 +567,11 @@ void TillingTool::fire(FireMode mode, bool shifting, bool edgeTriggered) {
}
}
-void TillingTool::update(FireMode fireMode, bool shifting, HashSet<MoveControlType> const& moves) {
- SwingableItem::update(fireMode, shifting, moves);
+void TillingTool::update(float dt, FireMode fireMode, bool shifting, HashSet<MoveControlType> const& moves) {
+ SwingableItem::update(dt, fireMode, shifting, moves);
if (!ready() && !coolingDown())
- m_frameTiming = std::fmod((m_frameTiming + WorldTimestep), m_frameCycle);
+ m_frameTiming = std::fmod((m_frameTiming + dt), m_frameCycle);
else
m_frameTiming = 0;
}
@@ -620,9 +620,9 @@ void PaintingBeamTool::setEnd(EndType type) {
m_endType = EndType::Object;
}
-void PaintingBeamTool::update(FireMode fireMode, bool shifting, HashSet<MoveControlType> const& moves) {
- BeamItem::update(fireMode, shifting, moves);
- FireableItem::update(fireMode, shifting, moves);
+void PaintingBeamTool::update(float dt, FireMode fireMode, bool shifting, HashSet<MoveControlType> const& moves) {
+ BeamItem::update(dt, fireMode, shifting, moves);
+ FireableItem::update(dt, fireMode, shifting, moves);
}
List<PreviewTile> PaintingBeamTool::preview(bool shifting) const {