how to use entities to make a parachute mod

User avatar
ErrorNull
Member
 
Posts: 94
Joined: Thu Mar 03, 2016 00:43

how to use entities to make a parachute mod

by ErrorNull » Mon Dec 05, 2016 11:50

Hello! I'm planning to make a parachute mod... player jumps off a cliff and with a parachute in the hotbar, player uses the item and an opened parachute appears above player and slows the fall to a gentle glide. So in essence, i believe the mod will need to spawn an entity and attach to player, then have to make the entity reduce the acceleration. I don't have much experience yet with entities, but I think this is how it should be done? Some rough pseudocode:

1. register parachute entity with minetest.register_entity()
2. player uses parachute
3. if (player's feet not in air) then parachute not used
4. else, deploy parachute with minetest.add_entity() one or two nodes above player
5. attach player to parachute entity
6. set parachute acceleration (or velocity?) down to slow player's fall
7. make parachute disappear when player's feet touch the ground

Can someone give me some guidance on what functions I need to use to do this (mostly lines 4, 5, 6, and 7) or a mod that you know that can reveal what entity functions i must use and how to use them? Thanks!
 

User avatar
mahmutelmas06
Member
 
Posts: 355
Joined: Mon Mar 02, 2015 13:10
GitHub: mahmutelmas06
IRC: mahmutelmas06
In-game: masum

Re: how to use entities to make a parachute mod

by mahmutelmas06 » Mon Dec 05, 2016 20:09

There is already parachute in vehicles mod and one onether.

viewtopic.php?t=9693
viewtopic.php?f=9&t=15610
My Mods:

Beverage
 

User avatar
ErrorNull
Member
 
Posts: 94
Joined: Thu Mar 03, 2016 00:43

Re: how to use entities to make a parachute mod

by ErrorNull » Mon Dec 05, 2016 23:28

Perfect! thanks mahmutelmas.. since looks like parachute already exists i will then change my idea to something like winged boots or angel wings or something like that... to keep with fantasy story setting. i'll study the code from webdesigner97's parachute mod so i can learn using entities.
 


Return to Modding Discussion

Who is online

Users browsing this forum: Bing [Bot] and 63 guests

cron