[Mod] Yet Another Bandage [bandage]

User avatar
everamzah
Member
 
Posts: 490
Joined: Thu Jan 29, 2015 00:47
GitHub: everamzah
IRC: everamzah
In-game: everamzah

[Mod] Yet Another Bandage [bandage]

by everamzah » Fri Jun 17, 2016 19:11

Really a small mod using one cotton (farming:cotton) and two paper (default:paper) to make one bandage (bandage:bandage). If you have lost hearts, using a bandage will restore up to two of them (4 HP). Otherwise the bandage remains unused.

It's a bandage ha! I made it so that I could restore health points independent of hunger, and without using minetest.item_eat().


Update: If you get hurt and have fewer than two hearts, and there's at least one bandage in your hotbar, then it will be automatically applied.

License: GPL3
Download: GitHub or master.zip

Image

Image
Attachments
screenshot_20160617_150930.png
screenshot_20160617_150930.png (104.14 KiB) Viewed 657 times
screenshot_20160617_150430_1.png
screenshot_20160617_150430_1.png (179.68 KiB) Viewed 657 times
Last edited by everamzah on Sat Jun 18, 2016 20:46, edited 4 times in total.
 

User avatar
azekill_DIABLO
Member
 
Posts: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: [Mod] Yet Another Bandage [bandage]

by azekill_DIABLO » Sat Jun 18, 2016 10:51

cool! it's an apple with a texture no?
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 

User avatar
everamzah
Member
 
Posts: 490
Joined: Thu Jan 29, 2015 00:47
GitHub: everamzah
IRC: everamzah
In-game: everamzah

Re: [Mod] Yet Another Bandage [bandage]

by everamzah » Sat Jun 18, 2016 10:55

It's a bandage ha! I made it so that I could restore health points independent of hunger, and without using minetest.item_eat().
 

User avatar
azekill_DIABLO
Member
 
Posts: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: [Mod] Yet Another Bandage [bandage]

by azekill_DIABLO » Sat Jun 18, 2016 11:11

ok! better now!you should say it in your 1st post
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 

User avatar
everamzah
Member
 
Posts: 490
Joined: Thu Jan 29, 2015 00:47
GitHub: everamzah
IRC: everamzah
In-game: everamzah

Re: [Mod] Yet Another Bandage [bandage]

by everamzah » Sat Jun 18, 2016 11:50

Ok! It is done. I thought, by the way, briefly, that it would be interesting to automatically apply a bandage if you have fewer than two hearts and you're holding bandages in your hotbar.
 

User avatar
azekill_DIABLO
Member
 
Posts: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: [Mod] Yet Another Bandage [bandage]

by azekill_DIABLO » Sat Jun 18, 2016 12:04

do this with
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_on_player_hpchange(function(player, hp_change)
   if hp_change>2 then
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 

User avatar
everamzah
Member
 
Posts: 490
Joined: Thu Jan 29, 2015 00:47
GitHub: everamzah
IRC: everamzah
In-game: everamzah

Re: [Mod] Yet Another Bandage [bandage]

by everamzah » Sat Jun 18, 2016 20:39

Okay, I got something. hp_change is a negative when it's damage. I also changed the license to GPL3.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_on_player_hpchange(function(player, hp_change)
   if hp_change >= 0 then
      return hp_change
   end
   local hp = player:get_hp()
   if hp + hp_change < 4 and hp + hp_change > 0 then
      for i, v in pairs(player:get_inventory():get_list("main")) do
         if i <= 8 then
            if v:get_name() == "bandage:bandage" then
               minetest.chat_send_player(player:get_player_name(), "Automatically applying bandage")
               v:take_item(1)
               player:get_inventory():set_stack("main", i, v)
               hp_change = hp_change + 2
            end
         end
      end
   end
   return hp_change
end, true)


Not sure how well this will work in combat. Will test now.
 

User avatar
cd2
Member
 
Posts: 552
Joined: Mon Jun 01, 2015 06:30
GitHub: cdqwertz
IRC: freenode - cd2 InchraNet - cd
In-game: cd cd2

Re: [Mod] Yet Another Bandage [bandage]

by cd2 » Sun Jun 19, 2016 09:26

everamzah wrote:Okay, I got something. hp_change is a negative when it's damage. I also changed the license to GPL3.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_on_player_hpchange(function(player, hp_change)
   if hp_change >= 0 then
      return hp_change
   end
   local hp = player:get_hp()
   if hp + hp_change < 4 and hp + hp_change > 0 then
      for i, v in pairs(player:get_inventory():get_list("main")) do
         if i <= 8 then
            if v:get_name() == "bandage:bandage" then
               minetest.chat_send_player(player:get_player_name(), "Automatically applying bandage")
               v:take_item(1)
               player:get_inventory():set_stack("main", i, v)
               hp_change = hp_change + 2
            end
         end
      end
   end
   return hp_change
end, true)


Not sure how well this will work in combat. Will test now.


+1
 

User avatar
azekill_DIABLO
Member
 
Posts: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: [Mod] Yet Another Bandage [bandage]

by azekill_DIABLO » Sun Jun 19, 2016 10:40

look a fork!
i've done it yesterday. i'm planning to add a timer feature
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 

Fixerol
Member
 
Posts: 633
Joined: Sun Jul 31, 2011 11:23
IRC: Fixer
In-game: Fixer

Re: [Mod] Yet Another Bandage [bandage]

by Fixerol » Wed Nov 09, 2016 17:04

 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 13 guests

cron