Feature: no stamina? drink a coffee! (#5) Farming mod support.
* Create init.coffee.lua * Update init.lua * Update depends.txt * Update README.mdmaster
parent
23f713d59e
commit
dcae463550
|
@ -9,6 +9,7 @@ Minetest mod for sprinting with W, A and D buttons.
|
|||
1. Press A and D simultaneously to trigger the `ready_to_sprint` state.
|
||||
2. Then press W to start sprinting.
|
||||
3. Release A and D (keep W pressed) and continue sprinting until the stamina runs out.
|
||||
4. Drink a coffee to faster regenerate the stamina.
|
||||
|
||||
**How to download**
|
||||
|
||||
|
@ -31,6 +32,7 @@ All mod dependencies are optional.
|
|||
- [hud?](https://github.com/BlockMen/hud_hunger)
|
||||
- [hudbars?](http://repo.or.cz/minetest_hudbars.git)
|
||||
- [player_monoids?](https://github.com/minetest-mods/player_monoids)
|
||||
- [farming?](https://notabug.org/tenplus1/farming)
|
||||
|
||||
**Dependents**
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
hud?
|
||||
hudbars?
|
||||
player_monoids?
|
||||
farming?
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
if minetest.registered_nodes["farming:coffee_cup"] then
|
||||
minetest.override_item("farming:coffee_cup", {
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if user == nil then return end -- better save then sorry
|
||||
minetest_wadsprint.api.addstamina(user:get_player_name(), 0.25)
|
||||
itemstack:take_item()
|
||||
local leftover = user:get_inventory():add_item("main", "vessels:drinking_glass")
|
||||
if not leftover:is_empty() then -- no free spot in players inventory
|
||||
minetest.item_drop(leftover, user, user:get_pos())
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
end
|
1
init.lua
1
init.lua
|
@ -34,6 +34,7 @@ dofile(minetest.get_modpath(minetest.get_current_modname()).."/init.legacy.lua")
|
|||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/init.config.lua")
|
||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/init.hudbars.lua")
|
||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/init.set_sprinting_physics.lua")
|
||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/init.coffee.lua")
|
||||
----------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------ Mod initialization --
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue