#2x3 Door script mistake

1 messages ยท Page 1 of 1 (latest)

spare laurel
#

@formal mirage

formal mirage
#

I'll probably be able to answer when I get home. In about an hour.

spare laurel
#

Okay

formal mirage
#

and could you send the whole code because in this file there is only class

spare laurel
#

Yes?

#

It doesn't matter, it's just the custom property code name

spare laurel
spare laurel
#

So...

#

Do you know how to fix it?

formal mirage
#

So..

#

Firstly, it is not very good that your methods accept 10000000 parameters. In this case, it is better to make an object with different parameters

#

Secondly, you use one class for all doors, this is not very good

formal mirage
#

I would do it like this: a BigDoor class with static methods register and get. register - takes a door pattern and registers it in a global variable. get - takes a Block parameter and based on it gets the door blocks associated with this block and returns the BigDoor class. The BigDoor class would have methods such as open(), close(), rotate() and the like for convenient use. Then in a separate file you would write the code for registering the door and then, based on events, make the door control (that is, closing and opening via BigDoor.get(block).open())

#

Again, I would do it that way. But it's up to you to decide what's more convenient. In any case, I think the error is because you're using one object for all doors (i.e. declaring a constant at the beginning of the code and then using it for all doors)

#

And by the way, now I also want to create custom doors, so I think I'll make some kind of template for this and put it on dev-resources

spare laurel
formal mirage
formal mirage
#

๐Ÿ‘€

flint spruce
queen flint
#

They said they would make a template on the idea not taking your code