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.
|
1. Press A and D simultaneously to trigger the `ready_to_sprint` state.
|
||||||
2. Then press W to start sprinting.
|
2. Then press W to start sprinting.
|
||||||
3. Release A and D (keep W pressed) and continue sprinting until the stamina runs out.
|
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**
|
**How to download**
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ All mod dependencies are optional.
|
||||||
- [hud?](https://github.com/BlockMen/hud_hunger)
|
- [hud?](https://github.com/BlockMen/hud_hunger)
|
||||||
- [hudbars?](http://repo.or.cz/minetest_hudbars.git)
|
- [hudbars?](http://repo.or.cz/minetest_hudbars.git)
|
||||||
- [player_monoids?](https://github.com/minetest-mods/player_monoids)
|
- [player_monoids?](https://github.com/minetest-mods/player_monoids)
|
||||||
|
- [farming?](https://notabug.org/tenplus1/farming)
|
||||||
|
|
||||||
**Dependents**
|
**Dependents**
|
||||||
|
|
||||||
|
@ -52,4 +54,4 @@ https://github.com/aa6/minetest_wadsprint/commits/master
|
||||||
|
|
||||||
**Credits**
|
**Credits**
|
||||||
|
|
||||||
Thanks to [GunshipPenguin](https://github.com/GunshipPenguin) and his [sprint mod](https://github.com/GunshipPenguin/sprint) for showing a good example of how sprint mod for minetest can be done.
|
Thanks to [GunshipPenguin](https://github.com/GunshipPenguin) and his [sprint mod](https://github.com/GunshipPenguin/sprint) for showing a good example of how sprint mod for minetest can be done.
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
hud?
|
hud?
|
||||||
hudbars?
|
hudbars?
|
||||||
player_monoids?
|
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
|
3
init.lua
3
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.config.lua")
|
||||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/init.hudbars.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.set_sprinting_physics.lua")
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname()).."/init.coffee.lua")
|
||||||
----------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------
|
||||||
------------------------------------------------------------------------------ Mod initialization --
|
------------------------------------------------------------------------------ Mod initialization --
|
||||||
----------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------
|
||||||
|
@ -76,4 +77,4 @@ minetest.register_globalstep(function(seconds_since_last_global_step) -- Called
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in New Issue