Fetch bingo squares from URL rather than hard-coding them in GDScript.

This commit is contained in:
Kaj Forney 2020-09-20 23:45:23 -06:00
parent f3af039882
commit c03c702d6f
Signed by: kforney
GPG key ID: 3AB4E2E04CEF656F
5 changed files with 89 additions and 66 deletions

1
.gitignore vendored
View file

@ -3,7 +3,6 @@
# Godot-specific ignores
.import/
export.cfg
export_presets.cfg
# Mono-specific ignores
.mono/

78
Main.gd
View file

@ -1,67 +1,20 @@
extends Node
var strings = [
"Someone asks where to find an unreleased song",
"Akira gets aggro at someone in chat on stream-mods",
"Darkwing_j makes an appearance",
"Lopar makes a poll",
"Inquiry about how to join the non-existent Discord server",
"Mods get distracted by stream-mod chat",
"Annoying Jojo reference",
"Akira beats everyone else to something",
"Someone makes a business request in chat",
"Sub Bomb of 20+",
"AutoMod catches a perfectly normal message",
"Insomniac_Rap Raid",
"Jirard Raid",
"We timeout someone",
"We ban someone",
"We delete a message",
"Hugspam",
"Broken Shigi",
"Mood Flip",
"Someone asks who made Saitou's graphics",
"AutoMod catches an actual bad message",
"Tax Cheer",
"Fireworks Cheer",
"Star Cheer",
"Hype Train",
"Raid right at the end of the stream",
"We add a new word to the AutoMod block list",
"DSKoopa Raid",
"Someone just finished Rakuen",
"Someone spams a request in chat",
"Someone asks for personal information",
"We ask someone to stop spamming",
"Someone asks about effects/echo",
"Widetou appears",
"Oddtou appears",
"Saitou is Missing",
"Rapid-Fire Requests",
"Hype Train reaches max level",
"We DM someone",
"Someone asks about musical equipment",
"Someone asks for piano tutorials",
"Someone tries to post a link in chat",
"Buck Bumble",
"We need Google Translate's assistance",
"Someone claims a song sounds like something else",
"BWA HA HA",
"Overuse of the @supershigi tag",
"Hello from AN ENTIRE COUNTRY!",
"Akira and someone else say the same thing simultaneously",
"A dimpy person turns out to be cool",
"Live Learn",
"Someone needs to read the room",
"DJ Oddtou",
"Anime song request",
"Someone else sees/hears before us",
"Self-advertising",
"DEEP DREAM",
"TIMING"
]
var strings
func _ready():
$HTTPRequest.connect("request_completed", self, "_on_request_completed")
$HTTPRequest.request("https://lunarpenguin.net/stuff/stream-bingo/bingo-squares.json")
func _been_clicked(what):
var button = get_node("squares/%s/Marker" % what)
button.visible = !button.visible
pass # Replace with function body.
func _on_request_completed(result, response_code, headers, body):
var json = JSON.parse(body.get_string_from_utf8())
strings = json.result
randomize()
var rng = RandomNumberGenerator.new()
rng.randomize()
@ -76,8 +29,3 @@ func _ready():
get_node("squares/%s/Label" % j).set_text(strings[i])
get_node("squares/%s/Marker" % j).set_frame(rng.randi_range(0,3))
get_node("squares/%s/Marker" % j).modulate = Color(1,1,1,0.5)
func _been_clicked(what):
var button = get_node("squares/%s/Marker" % what)
button.visible = !button.visible
pass # Replace with function body.

View file

@ -876,6 +876,8 @@ autowrap = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HTTPRequest" type="HTTPRequest" parent="."]
[connection signal="been_clicked" from="squares/1" to="." method="_been_clicked"]
[connection signal="pressed" from="squares/1" to="squares/1" method="_on_pressed"]
[connection signal="been_clicked" from="squares/2" to="." method="_been_clicked"]

60
bingo-squares.json Normal file
View file

@ -0,0 +1,60 @@
[
"Someone asks where to find an unreleased song",
"Akira gets aggro at someone in chat on stream-mods",
"Darkwing_j makes an appearance",
"Lopar makes a poll",
"Inquiry about how to join the non-existent Discord server",
"Mods get distracted by stream-mod chat",
"Annoying Jojo reference",
"Akira beats everyone else to something",
"Someone makes a business request in chat",
"Sub Bomb of 20+",
"AutoMod catches a perfectly normal message",
"Insomniac_Rap Raid",
"Jirard Raid",
"We timeout someone",
"We ban someone",
"We delete a message",
"Hugspam",
"Broken Shigi",
"Mood Flip",
"Someone asks who made Saitou's graphics",
"AutoMod catches an actual bad message",
"Tax Cheer",
"Fireworks Cheer",
"Star Cheer",
"Hype Train",
"Raid right at the end of the stream",
"We add a new word to the AutoMod block list",
"DSKoopa Raid",
"Someone just finished Rakuen",
"Someone spams a request in chat",
"Someone asks for personal information",
"We ask someone to stop spamming",
"Someone asks about effects/echo",
"Widetou appears",
"Oddtou appears",
"Saitou is Missing",
"Rapid-Fire Requests",
"Hype Train reaches max level",
"We DM someone",
"Someone asks about musical equipment",
"Someone asks for piano tutorials",
"Someone tries to post a link in chat",
"Buck Bumble",
"We need Google Translate's assistance",
"Someone claims a song sounds like something else",
"BWA HA HA",
"Overuse of the @supershigi tag",
"Hello from AN ENTIRE COUNTRY!",
"Akira and someone else say the same thing simultaneously",
"A dimpy person turns out to be cool",
"Live Learn",
"Someone needs to read the room",
"DJ Oddtou",
"Anime song request",
"Someone else sees/hears before us",
"Self-advertising",
"DEEP DREAM",
"TIMING"
]

14
victory.tscn Normal file
View file

@ -0,0 +1,14 @@
[gd_scene format=2]
[node name="victory" type="Node2D"]
[node name="Particles2D" type="CPUParticles2D" parent="."]
position = Vector2( 182.944, 128.238 )
amount = 64
emission_shape = 1
emission_sphere_radius = 128.0
spread = 124.35
radial_accel = 70.97
radial_accel_random = 0.25
hue_variation = 1.0
hue_variation_random = 1.0