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

summaryrefslogtreecommitdiff
path: root/source/game/StarItemDrop.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-08-18 20:03:06 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-08-18 20:03:06 +1000
commitb51e174bdc158187fc110dc4a947946d3dc329c1 (patch)
treec1a61ba9edaa5ff0628f4275d16392ca12ddd4dd /source/game/StarItemDrop.cpp
parentab03c224dd154a4cce9cf60e20bb166e57f33d01 (diff)
Item drops inherit player velocity, other stuff
Diffstat (limited to 'source/game/StarItemDrop.cpp')
-rw-r--r--source/game/StarItemDrop.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/game/StarItemDrop.cpp b/source/game/StarItemDrop.cpp
index 895e4bb..8114de4 100644
--- a/source/game/StarItemDrop.cpp
+++ b/source/game/StarItemDrop.cpp
@@ -38,7 +38,7 @@ ItemDropPtr ItemDrop::createRandomizedDrop(ItemDescriptor const& descriptor, Vec
return itemDrop;
}
-ItemDropPtr ItemDrop::throwDrop(ItemPtr const& item, Vec2F const& position, Vec2F const& direction, bool eternal) {
+ItemDropPtr ItemDrop::throwDrop(ItemPtr const& item, Vec2F const& position, Vec2F const& velocity, Vec2F const& direction, bool eternal) {
if (!item)
return {};
@@ -47,7 +47,7 @@ ItemDropPtr ItemDrop::throwDrop(ItemPtr const& item, Vec2F const& position, Vec2
ItemDropPtr itemDrop = make_shared<ItemDrop>(item);
itemDrop->setPosition(position);
if (direction != Vec2F())
- itemDrop->setVelocity(vnorm(direction) * idconfig.getFloat("throwSpeed"));
+ itemDrop->setVelocity(velocity + vnorm(direction) * idconfig.getFloat("throwSpeed"));
itemDrop->setEternal(eternal);
itemDrop->setIntangibleTime(idconfig.getFloat("throwIntangibleTime"));
@@ -55,12 +55,12 @@ ItemDropPtr ItemDrop::throwDrop(ItemPtr const& item, Vec2F const& position, Vec2
return itemDrop;
}
-ItemDropPtr ItemDrop::throwDrop(ItemDescriptor const& itemDescriptor, Vec2F const& position, Vec2F const& direction, bool eternal) {
+ItemDropPtr ItemDrop::throwDrop(ItemDescriptor const& itemDescriptor, Vec2F const& position, Vec2F const& velocity, Vec2F const& direction, bool eternal) {
if (!itemDescriptor || itemDescriptor.isEmpty())
return {};
auto itemDatabase = Root::singleton().itemDatabase();
- auto itemDrop = throwDrop(itemDatabase->item(itemDescriptor), position, direction);
+ auto itemDrop = throwDrop(itemDatabase->item(itemDescriptor), position, velocity, direction);
itemDrop->setEternal(eternal);
return itemDrop;