food_storage
--Food storage component-- This component lets you slide one item into large foods, such as bread, cheese wheels, or cakes. Consuming food storages with an item inside can cause unique interactions, such as eating glass shards.
Vars | |
bad_chance_of_discovery | What are the odds we bite into the stored item? |
---|---|
good_chance_of_discovery | What are the odds we see the stored item before we bite it? |
initial_volume | The amount of volume the food has on creation - Used for probabilities |
minimum_weight_class | Minimum size items that can be inserted |
stored_item | Reference to what we have in our food. |
Procs | |
begin_remove_item | |
consume_food_storage | |
insert_item | |
on_requesting_context_from_item | Adds context sensitivy directly to the processable file for screentips Arguments: |
remove_item | Removes the stored item, putting it in user's hands or on the ground, then updates the reference. |
storage_consumed | When fully consumed, just drop the item out on the ground. |
try_inserting_item | |
try_removing_item | |
update_stored_item |
Var Details
bad_chance_of_discovery
What are the odds we bite into the stored item?
good_chance_of_discovery
What are the odds we see the stored item before we bite it?
initial_volume
The amount of volume the food has on creation - Used for probabilities
minimum_weight_class
Minimum size items that can be inserted
stored_item
Reference to what we have in our food.
Proc Details
begin_remove_item
-
Removes the item from the food, after a do_after.
-
Arguments
-
user - person removing the item.
consume_food_storage
-
Checks for stored items when the food is eaten.
-
If the food is eaten while an item is stored in it, calculates the odds that the item will be found.
-
Then, if the item is found before being bitten, the item is removed.
-
If the item is found by biting into it, calls on_accidental_consumption on the stored item.
-
Afterwards, removes the item from the food if it was discovered.
-
Arguments
-
target - person doing the eating (can be the same as user)
-
user - person causing the eating to happen
-
bitecount - how many times the current food has been bitten
-
bitesize - how large bties are for this food
insert_item
-
Inserts the item into the food, after a do_after.
-
Arguments
-
inserted_item - The item being inserted.
-
user - the person inserting the item.
on_requesting_context_from_item
Adds context sensitivy directly to the processable file for screentips Arguments:
- source - refers to item that will display its screentip
- context - refers to, in this case, an item that can be inserted into another item
- held_item - refers to item in user's hand, typically the one that will be inserted into the food item
- user - refers to user who will see the screentip when the proper context and tool are there
remove_item
Removes the stored item, putting it in user's hands or on the ground, then updates the reference.
storage_consumed
When fully consumed, just drop the item out on the ground.
try_inserting_item
-
Begins the process of inserted an item.
-
Clicking on the food storage with an item will begin a do_after, which if successful inserts the item.
-
Arguments
-
inserted_item - the item being placed into the food
-
user - the person inserting the item
try_removing_item
-
Begins the process of attempting to remove the stored item.
-
Clicking on food storage on grab intent will begin a do_after, which if successful removes the stored_item.
-
Arguments
-
user - the person removing the item.
update_stored_item
-
Updates the reference of the stored item.
-
Checks the food's contents for if an alternate item was placed into the food.
-
If there is an alternate item, updates the reference to the new item.
-
If there isn't, updates the reference to null.
-
Returns FALSE if the ref is nulled, or TRUE is another item replaced it.