MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / fire

Method fire

source/game/items/StarLiquidItem.cpp:48–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48void LiquidItem::fire(FireMode mode, bool shifting, bool edgeTriggered) {
49 if (!initialized() || !ready() || !owner()->inToolRange())
50 return;
51
52 PlaceLiquid placeLiquid{liquidId(), liquidQuantity()};
53 TileModificationList modifications;
54
55 float radius;
56
57 if (!shifting)
58 radius = m_blockRadius;
59 else
60 radius = m_altBlockRadius;
61
62 if (!multiplaceEnabled())
63 radius = 1;
64
65 for (auto pos : tileAreaBrush(radius, owner()->aimPosition(), true)) {
66 if (canPlaceAtTile(pos))
67 modifications.append({pos, placeLiquid});
68 }
69
70 // Make sure not to make any more modifications than we have consumables.
71 if (modifications.size() > count())
72 modifications.resize(count());
73 size_t failed = world()->applyTileModifications(modifications, false).size();
74 if (failed < modifications.size()) {
75 FireableItem::fire(mode, shifting, edgeTriggered);
76 consume(modifications.size() - failed);
77 }
78}
79
80LiquidId LiquidItem::liquidId() const {
81 return m_liquidId;

Callers

nothing calls this directly

Calls 8

tileAreaBrushFunction · 0.85
countFunction · 0.85
inToolRangeMethod · 0.45
aimPositionMethod · 0.45
appendMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected