Page 1 of 1

[NPC Pack] Polflip

Posted: Sat Jul 27, 2019 7:18 pm
by Emral
Flip! Flop! He will never stop!
He tries to move in one direction until he figures out it's impossible. A direction change happens after 2 unsuccessful flips. They can phase through rightside-up slopes from below. Thanks Redigit!

If you set them to "Don't Move", they operate on a timer instead.

A download link can be found here:
https://drive.google.com/file/d/12vILc5 ... sp=sharing

Demo:
https://www.youtube.com/watch?v=3yZSJNPa7u8
0:51

Installation instructions can be found in the handbook or in my thread.

Modifications and adaptations of the code is permitted. If you use this particular code as a basis for an enhanced version of these NPCs, please give credit.

Re: [NPC Pack] Polflip

Posted: Sat Jul 27, 2019 10:48 pm
by Wiimeiser
Appears to be incompatible with custom blocks (IDs 751-1000) and will flip immediately if it's standing on one or walks onto one. Other than that it works right.

Re: [NPC Pack] Polflip

Posted: Sun Jul 28, 2019 4:31 am
by Emral
Wiimeiser wrote:
Sat Jul 27, 2019 10:48 pm
Appears to be incompatible with custom blocks (IDs 751-1000) and will flip immediately if it's standing on one or walks onto one. Other than that it works right.
You have to register your block to the expandeddefines block lists. Polflip can't know what the collision is like from the sprite alone!

Re: [NPC Pack] Polflip

Posted: Sun Jul 28, 2019 10:17 am
by Wiimeiser
I don't know how to do that. Is it in the Polflip files or somewhere else?

Re: [NPC Pack] Polflip

Posted: Sun Jul 28, 2019 10:24 am
by Emral
Wiimeiser wrote:
Sun Jul 28, 2019 10:17 am
I don't know how to do that. Is it in the Polflip files or somewhere else?
Expandeddefines...
expandedDefines.registerBlock(id, typeList)
Typelist is something like expandedDefines.BLOCK_SOLID or expandedDefines.BLOCK_SEMISOLID (I think Block.SOLID and Block.SEMISOLID work too but I'm not sure).
A list of typelists can be found in expandedDefines.lua

Re: [NPC Pack] Polflip

Posted: Sun Jul 28, 2019 9:35 pm
by Wiimeiser
So I guess I add {751, 752, 753, 756, 757, 812, 822, 832, 842} (Not sure how it would work with the Exclusive Blocks states) to expandedDefines.BLOCK_SOLID then? I assume I just do that in the luna.lua somehow?