Tooltip api
This commit is contained in:
@@ -90,7 +90,7 @@ and they can only be registered during `setup`.
|
||||
|
||||
The rules are in the shared script because both sides need them: the server for tooltips, and clients to draw the fluid.
|
||||
Shared scripts have `ctx.items.exists(id)`, `ctx.items.name(id)`, `ctx.items.components(id)` and
|
||||
`ctx.items.sell_value(id)` for rules that read an item, like syrup named after its tree.
|
||||
`ctx.items.sell_value(id, data?)` for rules that read an item, like syrup named after its tree.
|
||||
|
||||
## Using Fluids
|
||||
|
||||
@@ -147,7 +147,8 @@ tooltip says what's in it and how much, like "Birch Log Syrup, 250 mB".
|
||||
A full one sells for its own `base_sell_value` and what its fluid is worth on top: the fluid's value for 1000 mB times
|
||||
how much it holds, rounded up to a whole number. A jar of maple syrup worth 40 a bucket sells for 10, and the jar's own
|
||||
value when it has one. It can't be sold if neither has a value. Server scripts get this from
|
||||
`ctx.items.sell_value(id, data)`, which the base game's shipping bin sells by, and tooltips show it.
|
||||
`ctx.items.sell_value(id, data)`, which the base game's shipping bin sells by. Client and shared scripts have it too,
|
||||
and the base game shows it in [tooltips](../gui/index.md#item-tooltips).
|
||||
|
||||
A server script fills and empties one through its [fluid handler](#fluid-handlers), and `ctx.items.fluid_capacity(id)`
|
||||
says how much one holds.
|
||||
|
||||
Reference in New Issue
Block a user