Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load custom extension locally in the packager #550

Closed
Alestore opened this issue Oct 10, 2022 · 20 comments · Fixed by #568
Closed

Load custom extension locally in the packager #550

Alestore opened this issue Oct 10, 2022 · 20 comments · Fixed by #568

Comments

@Alestore
Copy link

I'm not sure if this is possible, but I would like to understand if there is a way to be able to locally load an extension without having to go through external links when packaging the project.
This is because in an attempt to load a Controller extension from a link uploaded by me and a collaborator of mine on GitHub we were unable to start the extension on the project exported by the packager. The extension works correctly when using the TurboWarp editor, either locally using http://localhost:8000/controller.js or from the link uploaded by us https://blurryknight.github.io/controller.js.
I don't understand what the problem is.

@GarboMuffin
Copy link
Member

The packager has had an unfortunate issue for the last while where it uses the legacy Worker sandbox while the main site uses an iframe, which affects extensions that try to use some APIs, such as this one.

I'll see if that's something that can be fixed

In fact, in the packager, we might be able to just remove the sandbox entirely ???

@GarboMuffin
Copy link
Member

The plan is:

  • finish unsandboxed extension support (~1wk)
  • then the packager will always load extensions unsandboxed

@GarboMuffin
Copy link
Member

Turns out your extension still won't work because it's a ScratchX extension. You could consider switching to the gamepad extension on https://extensions.turbowarp.org/ instead, which should work in the packager and the unsandboxed extensions experiment.

@GarboMuffin GarboMuffin reopened this Nov 6, 2022
@Alestore
Copy link
Author

Alestore commented Nov 6, 2022

Turns out your extension still won't work because it's a ScratchX extension. You could consider switching to the gamepad extension on https://extensions.turbowarp.org/ instead, which should work in the packager and the unsandboxed extensions experiment.

oh ok then. thanks a lot!

@GarboMuffin
Copy link
Member

The gamepad extension is known to be very lacking right now. If there's any blocks you want, just ask

@Alestore
Copy link
Author

Alestore commented Nov 6, 2022

The gamepad extension is known to be very lacking right now. If there's any blocks you want, just ask

I was extremely comfortable with the ability to point the sprite in the direction of a stick

@GarboMuffin
Copy link
Member

GarboMuffin commented Nov 6, 2022

I have added some new blocks to the extension to help with that

@Alestore
Copy link
Author

Alestore commented Nov 6, 2022

I have added some new blocks to the extension to help with that

I looked now, phenomenal! Thanks again.

@Alestore
Copy link
Author

Alestore commented Nov 6, 2022

@GarboMuffin I don't know if this is possible, but is it possible to add a block that detects the controller layout? For example see if it uses an Xbox, PlayStation or Nintendo layout?

@GarboMuffin
Copy link
Member

GarboMuffin commented Nov 7, 2022

Browsers don't directly tell us that information, unfortunately. Sometimes they do tell us the name of the device, but each browser does it in a different way and I imagine there are a lot of differently named devices out there. In most cases, the placement of eg. button 1 should be the same on every controller, it just might have a different symbol on it.

@Alestore
Copy link
Author

Alestore commented Nov 7, 2022

Browsers don't directly tell us that information, unfortunately. Sometimes they do tell us the name of the device, but each browser does it in a different way and I imagine there are a lot of differently devices out there. In most cases, the placement of eg. button 1 should be the same on every controller, it just might have a different symbol on it.

Oh, okay then. I will put in the settings a button to select the layout as I had already done. Thank you very much for the information!

@Alestore
Copy link
Author

Alestore commented Nov 8, 2022

I have added some new blocks to the extension to help with that

I was thinking: can you add a "any button pressed on controller" block inside of the "if controller button pressed" list block?

@GarboMuffin
Copy link
Member

I've added "any" options to all the button and gamepad dropdowns.

@joshpinto6
Copy link
Contributor

@GarboMuffin I was actually working on a contribution that would do that 😄👍

@GamersUnited6001
Copy link

Can it support more then 4 controllers?

@GarboMuffin
Copy link
Member

GarboMuffin commented Nov 22, 2022

Chrome/Electron only support up to 4 controllers, but if you're using another browser you can insert join blocks in the dropdown to type any number in there.

@GamersUnited6001
Copy link

Can it support a controller with more then 16 buttons? When I look in the dropdown menu there are 16 buttons it can detect, but if I plug a different controller with more then 16 buttons would it still be able to detect them?

@GarboMuffin
Copy link
Member

Similar to the controller number input, you can just insert a join block in there, type in whatever number you want, and if the controller has that many buttons then it will just work.

@GarboMuffin
Copy link
Member

Closing as the issue has been worked around and if the original extension is run unsandboxed (as in the packager), it does behave exactly as the code says it should which may or may not include some bugs

@Alestore
Copy link
Author

I've added "any" options to all the button and gamepad dropdowns.

Would it be possible to also add a block "when the stick is moved", both in a specific way (stick L or R) and in a general way (one of the two sticks moved)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants