[Mod] [WIP] portalgun (based on UjEdwin)

User avatar
mrob27
Member
 
Posts: 21
Joined: Sun Sep 27, 2015 13:32
GitHub: mrob27

[Mod] [WIP] portalgun (based on UjEdwin)

by mrob27 » Wed Oct 07, 2015 15:21

Back in July, in this post, @UjEdwin posted this portal gun mod. It's a gun that shoots portals (which explains the name, portal gun :)

I've set it up on Github and I'm working on it.

Image

So far I've just cleaned up the formatting (tabs, spaces, indentation) and added a bunch of comments.

I also had to change it to make right-click shoot the orange portal, because for some reason I can't do the "right and left click at the same time" that UjEdwin's version expects. So the controls are:

  - Left-click to make blue portal
  - Right-click to make orange portal
  - Sneak (shift) + Left-click to remove both portals

Contributors - UjEdwin, mrob27
Depends - default
Download - None yet, use the github
Github - https://github.com/mrob27/portalgun
Licence - CC-BY-SA 3.0

Tested on Minetest 0.4.11 (that's all I have access to right now)

Biggest issues are:

  • Inability to set player's velocity means that when you exit a portal you just fall straight down. (But mobs and objects shoot out at the velocity you'd expect). I wrote a block comment explaining how to implement this.
  • It leaves old portals around sometimes, so even in singleplayer mode you can have multiple portals of one colour, but only the last one is actually active
  • Portals are oriented perpendicular to the direction you were looking when you shoot it, instead of being flat on the surface you attached it to.

Other related posts: P0RTAL-blocks, and math problem with portals.
 

User avatar
mrob27
Member
 
Posts: 21
Joined: Sun Sep 27, 2015 13:32
GitHub: mrob27

Re: [Mod] [WIP] portalgun (based on UjEdwin)

by mrob27 » Fri Oct 09, 2015 07:23

I've started adding staticdata for the entities, needed to fix some of the bugs. This mod depends on two types of data objects: a table of portal locations used by the globalstep function (which runs constantly, looking for things that have appeared or moved near a portal), and the entities (the visible objects in the world) which are the portals themselves. In order for portals to properly reappear after all players wander away from them and then a player wanders back, these two data objects need to remember each other's vital statistics.

I also added a sound effect for firing the gun (I have another that I'll add later, to be heard by a player when they pass through a portal) The sound effects have a compatible license and are from soundbible.com
 

User avatar
mrob27
Member
 
Posts: 21
Joined: Sun Sep 27, 2015 13:32
GitHub: mrob27

Re: [Mod] [WIP] portalgun (based on UjEdwin)

by mrob27 » Mon Oct 12, 2015 03:06

Players now emerge from horizontal (x+, x-, z+ and z-) portals with their backs to the portal they just exited.

Edit: It now does this for non-player entities too. Looks really good with rats and sheep.
 

Sokomine
Member
 
Posts: 3710
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] [WIP] portalgun (based on UjEdwin)

by Sokomine » Thu Oct 15, 2015 04:26

mrob27 wrote:Edit: It now does this for non-player entities too. Looks really good with rats and sheep.

Poor sheep :-) Do they at least get teleported to places with plenty of grass to eat?
A list of my mods can be found here.
 

User avatar
mrob27
Member
 
Posts: 21
Joined: Sun Sep 27, 2015 13:32
GitHub: mrob27

Re: [Mod] [WIP] portalgun (based on UjEdwin)

by mrob27 » Thu Oct 15, 2015 04:54

Sokomine wrote:
mrob27 wrote:Edit: It now does this for non-player entities too. Looks really good with rats and sheep.

Poor sheep :-) Do they at least get teleported to places with plenty of grass to eat?

Sure, just put the other portal out in the field. Actually I do that mainly when I'm trying to get the sheep back into the pen. They seem to escape a lot.

My sheep don't eat grass, just wheat, but I added about 5 sheep sounds so they don't keep making the same sound, and a bunch of textures so I can tell how many times I've fed each sheep, and tame sheep look different from wild sheep and walk slower. But I'm going to make the sheep eat grass once I get around to it.
 

Sokomine
Member
 
Posts: 3710
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] [WIP] portalgun (based on UjEdwin)

by Sokomine » Fri Oct 16, 2015 01:31

mrob27 wrote:Sure, just put the other portal out in the field. Actually I do that mainly when I'm trying to get the sheep back into the pen. They seem to escape a lot.

Yes, they're very good at that. The only thing that might help is to build an enclosure that's closed at the top as well. Else the sheep will reproduce and step on each other's back until they get out.

mrob27 wrote:My sheep don't eat grass, just wheat, but I added about 5 sheep sounds so they don't keep making the same sound, and a bunch of textures so I can tell how many times I've fed each sheep, and tame sheep look different from wild sheep and walk slower. But I'm going to make the sheep eat grass once I get around to it.

I'm sure they just prefer the wheat when fed and would eat grass otherwise :-) Adding further sheep sounds is a very notable extension. That may actually safe a lot of sheep's life, according to some youtube videos! Diffrent colors also sound good.
A list of my mods can be found here.
 

User avatar
mrob27
Member
 
Posts: 21
Joined: Sun Sep 27, 2015 13:32
GitHub: mrob27

Re: [Mod] [WIP] portalgun (based on UjEdwin)

by mrob27 » Fri Oct 16, 2015 06:17

The sheep were the first mod I started modding, but I do eventually plan to put it up on Github or something so people can take the bits I did and use them in one of the more popular mobs mods, like @TenPlus1's Mobs Redo.

But I'm stuck with Minetest 0.4.11 so I can't test my stuff to make sure it works for other people. So instead I'm using my mobs mod to learn modding.
 


Return to WIP Mods



Who is online

Users browsing this forum: No registered users and 5 guests