nairobi 1 year ago
parent
commit
8d791086f9
19 changed files with 1925 additions and 0 deletions
  1. 2 0
      .gitattributes
  2. 3 0
      .gitignore
  3. 163 0
      Bagelicious.cs
  4. 135 0
      Bagelicious.gd
  5. 272 0
      Bagelicious.tscn
  6. BIN
      banner.png
  7. 34 0
      banner.png.import
  8. 38 0
      export_presets.cfg
  9. 1 0
      icon.svg
  10. 37 0
      icon.svg.import
  11. 7 0
      ld53-bagelsdelicious.csproj
  12. 19 0
      ld53-bagelsdelicious.sln
  13. BIN
      logo.png
  14. 34 0
      logo.png.import
  15. 34 0
      project.godot
  16. 0 0
      server/.gdignore
  17. 1036 0
      server/package-lock.json
  18. 16 0
      server/package.json
  19. 94 0
      server/server.js

+ 2 - 0
.gitattributes

@@ -0,0 +1,2 @@
+# Normalize EOL for all files that Git considers text files.
+* text=auto eol=lf

+ 3 - 0
.gitignore

@@ -0,0 +1,3 @@
+# Godot 4+ specific ignores
+.godot/
+server/node_modules/

+ 163 - 0
Bagelicious.cs

@@ -0,0 +1,163 @@
+using Godot;
+using System;
+
+public partial class Bagelicious : Control
+{
+	private LineEdit _textEdit;
+	public String Code;
+	private HttpRequest _httpEntry = new HttpRequest();
+	private HttpRequest _httpButton = new HttpRequest();
+	private HttpRequest _httpLocation = new HttpRequest();
+	private Control _delivery;
+	private LineEdit _editX;
+	private LineEdit _editY;
+	private int _currentOrderId;
+	private Control _delivering;
+	private Timer TT = new Timer();
+	// private Random _rng = new Random();
+	// public char GenerateChar()
+	// {
+	// 	return (char) (_rng.Next('A', 'Z' + 1));
+	// }
+
+	// public string GenerateString(int length)
+	// { 
+	// 	char[] letters = new char[length];
+	// 	for (int i = 0; i < length; i++)
+	// 	{
+	// 		letters[i] = GenerateChar();
+	// 	}
+	// 	return new string(letters);
+	// }
+    public override void _Ready()
+    {
+		AddChild(_httpButton);
+		AddChild(_httpEntry);
+		AddChild(_httpLocation);
+
+        _httpButton.RequestCompleted += OnRequestCompletedButton;
+		_httpEntry.RequestCompleted += OnRequestCompletedEntry;
+		_httpLocation.RequestCompleted += OnRequestCompletedLoc;
+		_httpButton.Timeout = 2.0f;
+		_httpEntry.Timeout = 2.0f;
+		_httpLocation.Timeout = 2.0f;
+
+		_delivery = (Control)FindChild("Delivery");
+		_editX = (LineEdit)FindChild("LineEditE");
+		_editY = (LineEdit)FindChild("LineEditS");
+		_textEdit = (LineEdit)FindChild("EnterCode");
+
+		_delivering = GetNode<Control>("Delivering");
+		TT.WaitTime = 5.0;
+		TT.OneShot = true;
+		TT.Timeout += () => {
+			_delivering.Hide();
+		};
+		AddChild(TT);
+		
+		Code = "";
+
+		_textEdit.TextChanged += (String s) => {
+			if(s.Length == 4) {
+				String req = "https://nairobi.ninja/bagel/verify/" + s;
+				_httpEntry.Request(req);
+			}
+		};
+
+		foreach(Node bagelnode in GetTree().GetNodesInGroup("bagelbutton")) {
+			Button bagelbutton = (Button)bagelnode;
+			int id = bagelbutton.GetMeta("bagelid").As<int>();
+			bagelbutton.Pressed += () => {
+				if (Code.Length == 4) {
+					_currentOrderId = id;
+					_delivery.Show();
+				}
+			};
+		}
+
+		((Button)FindChild("SendBB")).Pressed += () => {
+			if(_editX.Text.Length > 0 && _editY.Text.Length > 0) {
+				String req = "https://nairobi.ninja/bagel/order/" + Code + "/" + _currentOrderId + "/" + _editX.Text + "/" + _editY.Text;
+				GD.Print(req);
+				foreach(Node bagelnode in GetTree().GetNodesInGroup("bagelbutton")) {
+					Button bagelbutton = (Button)bagelnode;
+					bagelbutton.Disabled = true;
+				}
+				_httpButton.Request(req);
+				_delivery.Hide();
+			}
+		};
+
+		(GetNode<Timer>("PosSpyTimer")).Timeout += () => {
+			if (Code.Length == 4) {
+				String req = "https://nairobi.ninja/bagel/getpos/" + Code;
+				_httpLocation.Request(req);
+			}
+		};
+    }
+
+	public override void _Input(InputEvent ev) {
+		if(ev.IsActionReleased("esc")) {
+			Code = "";
+			GetNode<Control>("OtherScreen").Show();
+			GetNode<Control>("MainScreen").Hide();
+			GetNode<Control>("PosSpy").Hide();
+		}
+	}
+
+	private void OnRequestCompletedLoc(long result, long responseCode, string[] headers, byte[] body){
+		Json j = new Json();
+		var e = j.Parse(System.Text.Encoding.UTF8.GetString(body));
+		if(e == Error.Ok) {
+			Variant x;
+			Variant y;
+			j.Data.AsGodotDictionary().TryGetValue("x", out x);
+			j.Data.AsGodotDictionary().TryGetValue("y", out y);
+			var xx = x.As<float>();
+			var yy = y.As<float>();
+			if(xx >= 0.0f || yy >= 0.0f) {
+				GetNode<RichTextLabel>("PosSpy/RichTextLabel").Text = "[center]Your location: (" + yy.ToString("0.000") + "°S, " + xx.ToString("0.000") + "°E)[/center]";
+			} else {
+				GetNode<RichTextLabel>("PosSpy/RichTextLabel").Text = "[center]Your location: unreachable[/center]";
+			}
+		} else {
+			GetNode<RichTextLabel>("PosSpy/RichTextLabel").Text = "[center]Connection lost[/center]";
+		}
+	}
+
+	private void OnRequestCompletedEntry(long result, long responseCode, string[] headers, byte[] body)
+    {
+		var res = System.Text.Encoding.UTF8.GetString(body);
+		if(responseCode == 200 && res.Length == 4) {
+        	Code = res;
+			_textEdit.Text = "";
+			GetNode<Control>("OtherScreen").Hide();
+			GetNode<Control>("MainScreen").Show();
+			GetNode<Control>("PosSpy").Show();
+		} else if(responseCode == 404) {
+			_textEdit.Text = "";
+			_textEdit.PlaceholderText = "Invalid code";
+		} else {
+			_textEdit.Text = "";
+			_textEdit.PlaceholderText = "Server unreachable";
+		}
+    }
+
+    private void OnRequestCompletedButton(long result, long responseCode, string[] headers, byte[] body)
+    {
+        if(responseCode == 200) {
+			foreach(Node bagelnode in GetTree().GetNodesInGroup("bagelbutton")) {
+				Button bagelbutton = (Button)bagelnode;
+				bagelbutton.Disabled = false;
+			}
+			_delivering.Show();
+			TT.Start();
+		} else {
+			GetNode<Control>("OtherScreen").Show();
+			GetNode<Control>("MainScreen").Hide();
+			GetNode<Control>("PosSpy").Hide();
+			Code = "";
+			_textEdit.PlaceholderText = "Server unreachable";
+		}
+    }
+}

+ 135 - 0
Bagelicious.gd

@@ -0,0 +1,135 @@
+extends Control
+
+var _textEdit;
+var Code;
+var _httpEntry = HTTPRequest.new();
+var _httpButton = HTTPRequest.new();
+var _httpLocation = HTTPRequest.new();
+var _delivery;
+var _editX;
+var _editY;
+var _currentOrderId;
+var _delivering;
+var TT = Timer.new();
+
+func FuckYou():
+	_delivering.Hide();
+	
+func FuckYou2(s: String):
+	if s.length() == 4:
+		var req = "https://nairobi.ninja/bagel/verify/" + s
+		_httpEntry.request(req)
+
+func _ready():
+	add_child(_httpButton);
+	add_child(_httpEntry);
+	add_child(_httpLocation);
+
+	_httpButton.request_completed.connect(OnRequestCompletedButton);
+	_httpEntry.request_completed.connect(OnRequestCompletedEntry);
+	_httpLocation.request_completed.connect(OnRequestCompletedLoc);
+	_httpButton.set_timeout(2.0)
+	_httpEntry.set_timeout(2.0)
+	_httpLocation.set_timeout(2.0)
+
+	_delivery = find_child("Delivery");
+	_editX = find_child("LineEditE");
+	_editY = find_child("LineEditS");
+	_textEdit = find_child("EnterCode");
+
+	_delivering = $"Delivering";
+	TT.wait_time = 5.0;
+	TT.oneshot = true;
+	TT.timeout.connect(FuckYou)
+	add_child(TT);
+		
+	Code = "";
+
+	_textEdit.text_changed.connect(FuckYou2);
+
+#	foreach(Node bagelnode in GetTree().GetNodesInGroup("bagelbutton")) {
+#		Button bagelbutton = (Button)bagelnode;
+#		int id = bagelbutton.GetMeta("bagelid").As<int>();
+#		bagelbutton.Pressed += () => {
+#			if (Code.Length == 4) {
+#				_currentOrderId = id;
+#				_delivery.Show();
+#			}
+#		};
+#	}
+#
+#	((Button)FindChild("SendBB")).Pressed += () => {
+#		if(_editX.Text.Length > 0 && _editY.Text.Length > 0) {
+#			String req = "https://nairobi.ninja/bagel/order/" + Code + "/" + _currentOrderId + "/" + _editX.Text + "/" + _editY.Text;
+#			GD.Print(req);
+#			foreach(Node bagelnode in GetTree().GetNodesInGroup("bagelbutton")) {
+#				Button bagelbutton = (Button)bagelnode;
+#				bagelbutton.Disabled = true;
+#			}
+#			_httpButton.Request(req);
+#			_delivery.Hide();
+#		}
+#	};
+#
+#	(GetNode<Timer>("PosSpyTimer")).Timeout += () => {
+#		if (Code.Length == 4) {
+#			String req = "https://nairobi.ninja/bagel/getpos/" + Code;
+#			_httpLocation.Request(req);
+#		}
+#	};
+
+func _input(ev: InputEvent):
+	if ev.IsActionReleased("esc"):
+		Code = "";
+		$"OtherScreen".show();
+		$"MainScreen".hide();
+		$"PosSpy".hide();
+
+func OnRequestCompletedLoc(result, responseCode, headers, body):
+	var j = JSON.new();
+	var e = j.parse(body);
+	if e == OK:
+		pass
+#		var x
+#		var y
+#		j.Data.AsGodotDictionary().TryGetValue("x", out x);
+#		j.Data.AsGodotDictionary().TryGetValue("y", out y);
+#		var xx = x.As<float>();
+#		var yy = y.As<float>();
+#		if(xx >= 0.0f || yy >= 0.0f) {
+#			GetNode<RichTextLabel>("PosSpy/RichTextLabel").Text = "[center]Your location: (" + yy.ToString("0.000") + "°S, " + xx.ToString("0.000") + "°E)[/center]";
+#		} else {
+#			GetNode<RichTextLabel>("PosSpy/RichTextLabel").Text = "[center]Your location: unreachable[/center]";
+#		}
+#	} else {
+#		GetNode<RichTextLabel>("PosSpy/RichTextLabel").Text = "[center]Connection lost[/center]";
+#	}
+
+func OnRequestCompletedEntry(result, responseCode, headers, body):
+	pass
+#	var res = System.Text.Encoding.UTF8.GetString(body);
+#	if(responseCode == 200 && res.Length == 4) {
+#		Code = res;
+#		_textEdit.Text = "";
+#		GetNode<Control>("OtherScreen").Hide();
+#		GetNode<Control>("MainScreen").Show();
+#		GetNode<Control>("PosSpy").Show();
+#	} else if(responseCode == 404) {
+#		_textEdit.Text = "";
+#		_textEdit.PlaceholderText = "Invalid code";
+#	else:
+#		_textEdit.Text = "";
+#		_textEdit.PlaceholderText = "Server unreachable";
+
+func OnRequestCompletedButton(result, responseCode, headers, body):
+	if responseCode == 200:
+		for bagelnode in get_tree().get_nodes_in_group("bagelbutton"):
+			bagelnode.disabled = false;
+			_delivering.show();
+			TT.start();
+	else:
+		$"OtherScreen".show();
+		$"MainScreen".hide();
+		$"PosSpy".hide();
+		Code = "";
+		_textEdit.placeholder_text = "Server unreachable";

+ 272 - 0
Bagelicious.tscn

@@ -0,0 +1,272 @@
+[gd_scene load_steps=5 format=3 uid="uid://cd0xdv24ktxi"]
+
+[ext_resource type="Texture2D" uid="uid://c3vxfjwswbbps" path="res://logo.png" id="1_f3t2f"]
+[ext_resource type="Script" path="res://Bagelicious.gd" id="1_ya5nu"]
+[ext_resource type="Texture2D" uid="uid://b8fsbj1y78kk2" path="res://banner.png" id="2_mgmb0"]
+
+[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_l6t2m"]
+content_margin_left = 10.0
+content_margin_top = 10.0
+content_margin_right = 10.0
+content_margin_bottom = 10.0
+bg_color = Color(0.427451, 0.313726, 0.537255, 1)
+expand_margin_left = 5.0
+expand_margin_top = 5.0
+expand_margin_right = 5.0
+expand_margin_bottom = 5.0
+
+[node name="Bagelicious" type="Control"]
+layout_mode = 3
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+mouse_filter = 1
+script = ExtResource("1_ya5nu")
+
+[node name="MainScreen" type="VBoxContainer" parent="."]
+visible = false
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+
+[node name="s" type="TextureRect" parent="MainScreen"]
+custom_minimum_size = Vector2(0, 220)
+layout_mode = 2
+size_flags_vertical = 0
+texture = ExtResource("2_mgmb0")
+expand_mode = 1
+stretch_mode = 6
+
+[node name="AspectRatioContainer" type="AspectRatioContainer" parent="MainScreen"]
+layout_mode = 2
+ratio = 0.6
+stretch_mode = 1
+
+[node name="Description" type="MarginContainer" parent="MainScreen/AspectRatioContainer"]
+layout_mode = 2
+theme_override_constants/margin_left = 10
+theme_override_constants/margin_top = 10
+theme_override_constants/margin_right = 10
+theme_override_constants/margin_bottom = 10
+
+[node name="VBoxContainer" type="VBoxContainer" parent="MainScreen/AspectRatioContainer/Description"]
+layout_mode = 2
+
+[node name="RichTextLabel" type="RichTextLabel" parent="MainScreen/AspectRatioContainer/Description/VBoxContainer"]
+layout_mode = 2
+bbcode_enabled = true
+text = "[color=#f9a9abff][font_size=24]Far Away Bagels[/font_size][/color]
+[color=#b14b54ff][font_size=16]★★☆☆☆[/font_size] [font_size=9]61 reviews[/font_size][/color]
+
+[color=#f9a9abff][font_size=18]Popular[/font_size][/color]"
+fit_content = true
+
+[node name="Offers" type="VBoxContainer" parent="MainScreen/AspectRatioContainer/Description/VBoxContainer"]
+layout_mode = 2
+size_flags_horizontal = 3
+
+[node name="Bagel" type="MarginContainer" parent="MainScreen/AspectRatioContainer/Description/VBoxContainer/Offers"]
+layout_mode = 2
+theme_override_constants/margin_left = 5
+theme_override_constants/margin_top = 5
+theme_override_constants/margin_right = 5
+theme_override_constants/margin_bottom = 5
+
+[node name="HBoxContainer" type="HBoxContainer" parent="MainScreen/AspectRatioContainer/Description/VBoxContainer/Offers/Bagel"]
+layout_mode = 2
+size_flags_vertical = 0
+
+[node name="RichTextLabel2" type="RichTextLabel" parent="MainScreen/AspectRatioContainer/Description/VBoxContainer/Offers/Bagel/HBoxContainer"]
+layout_mode = 2
+size_flags_horizontal = 3
+size_flags_vertical = 0
+bbcode_enabled = true
+text = "[color=#f9ddabff][b]1. Bagel Deluxe[/b]
+[font_size=10]With no additives or chemicals and only organic 100% premium hormone-free brown sugar, we serve up a bagel so delicious you will be left speechless.[/font_size][/color]
+[color=#f9a9abff][font_size=15]4.99 💰[/font_size][/color]"
+fit_content = true
+scroll_active = false
+
+[node name="Button" type="Button" parent="MainScreen/AspectRatioContainer/Description/VBoxContainer/Offers/Bagel/HBoxContainer" groups=["bagelbutton"]]
+layout_mode = 2
+size_flags_vertical = 0
+theme_override_colors/font_color = Color(0.976471, 0.866667, 0.670588, 1)
+text = "  +  "
+metadata/bagelid = 0
+
+[node name="Bagel2" type="MarginContainer" parent="MainScreen/AspectRatioContainer/Description/VBoxContainer/Offers"]
+layout_mode = 2
+theme_override_constants/margin_left = 5
+theme_override_constants/margin_top = 5
+theme_override_constants/margin_right = 5
+theme_override_constants/margin_bottom = 5
+
+[node name="HBoxContainer" type="HBoxContainer" parent="MainScreen/AspectRatioContainer/Description/VBoxContainer/Offers/Bagel2"]
+layout_mode = 2
+size_flags_vertical = 0
+
+[node name="RichTextLabel2" type="RichTextLabel" parent="MainScreen/AspectRatioContainer/Description/VBoxContainer/Offers/Bagel2/HBoxContainer"]
+layout_mode = 2
+size_flags_horizontal = 3
+size_flags_vertical = 0
+bbcode_enabled = true
+text = "[color=#f9ddabff][b]4. Concrete Bagel[/b]
+[font_size=10]This bagel is an eternal classic. The base of the bagel is a concrete patty that's layered with laminate.[/font_size][/color]
+[color=#f9a9abff][font_size=15]14.99 💰[/font_size][/color]"
+fit_content = true
+scroll_active = false
+
+[node name="Button" type="Button" parent="MainScreen/AspectRatioContainer/Description/VBoxContainer/Offers/Bagel2/HBoxContainer" groups=["bagelbutton"]]
+layout_mode = 2
+size_flags_vertical = 0
+theme_override_colors/font_color = Color(0.976471, 0.866667, 0.670588, 1)
+text = "  +  "
+metadata/bagelid = 1
+
+[node name="Delivery" type="CenterContainer" parent="MainScreen/AspectRatioContainer"]
+visible = false
+layout_mode = 2
+
+[node name="Panel" type="PanelContainer" parent="MainScreen/AspectRatioContainer/Delivery"]
+layout_mode = 2
+mouse_filter = 1
+theme_override_styles/panel = SubResource("StyleBoxFlat_l6t2m")
+
+[node name="VBoxContainer" type="VBoxContainer" parent="MainScreen/AspectRatioContainer/Delivery/Panel"]
+layout_mode = 2
+
+[node name="RichTextLabel" type="RichTextLabel" parent="MainScreen/AspectRatioContainer/Delivery/Panel/VBoxContainer"]
+layout_mode = 2
+bbcode_enabled = true
+text = " [color=#f9ddabff]Delivery address[/color]"
+fit_content = true
+autowrap_mode = 0
+
+[node name="HBoxContainer2" type="HBoxContainer" parent="MainScreen/AspectRatioContainer/Delivery/Panel/VBoxContainer"]
+layout_mode = 2
+
+[node name="LineEditS" type="LineEdit" parent="MainScreen/AspectRatioContainer/Delivery/Panel/VBoxContainer/HBoxContainer2"]
+layout_mode = 2
+size_flags_horizontal = 3
+virtual_keyboard_type = 2
+
+[node name="Label" type="Label" parent="MainScreen/AspectRatioContainer/Delivery/Panel/VBoxContainer/HBoxContainer2"]
+layout_mode = 2
+theme_override_colors/font_color = Color(0.976471, 0.866667, 0.670588, 1)
+text = "°S"
+
+[node name="HBoxContainer" type="HBoxContainer" parent="MainScreen/AspectRatioContainer/Delivery/Panel/VBoxContainer"]
+layout_mode = 2
+
+[node name="LineEditE" type="LineEdit" parent="MainScreen/AspectRatioContainer/Delivery/Panel/VBoxContainer/HBoxContainer"]
+layout_mode = 2
+size_flags_horizontal = 3
+virtual_keyboard_type = 2
+
+[node name="Label" type="Label" parent="MainScreen/AspectRatioContainer/Delivery/Panel/VBoxContainer/HBoxContainer"]
+layout_mode = 2
+theme_override_colors/font_color = Color(0.976471, 0.866667, 0.670588, 1)
+text = "°E"
+
+[node name="SendBB" type="Button" parent="MainScreen/AspectRatioContainer/Delivery/Panel/VBoxContainer"]
+layout_mode = 2
+theme_override_colors/font_color = Color(0.976471, 0.866667, 0.670588, 1)
+text = " Send "
+flat = true
+
+[node name="OtherScreen" type="AspectRatioContainer" parent="."]
+layout_mode = 1
+anchors_preset = -1
+anchor_top = 0.1
+anchor_right = 1.0
+anchor_bottom = 0.9
+grow_horizontal = 2
+grow_vertical = 2
+ratio = 0.6
+stretch_mode = 1
+
+[node name="LoginScreen" type="VBoxContainer" parent="OtherScreen"]
+layout_mode = 2
+size_flags_vertical = 4
+
+[node name="MarginContainer" type="MarginContainer" parent="OtherScreen/LoginScreen"]
+layout_mode = 2
+theme_override_constants/margin_left = 30
+theme_override_constants/margin_top = 30
+theme_override_constants/margin_right = 30
+theme_override_constants/margin_bottom = 5
+
+[node name="TextureRect" type="TextureRect" parent="OtherScreen/LoginScreen/MarginContainer"]
+layout_mode = 2
+texture = ExtResource("1_f3t2f")
+expand_mode = 4
+
+[node name="Label" type="RichTextLabel" parent="OtherScreen/LoginScreen"]
+layout_mode = 2
+bbcode_enabled = true
+text = "[center][b]Bagelicious[/b].me[/center]"
+fit_content = true
+
+[node name="MarginContainer2" type="MarginContainer" parent="OtherScreen/LoginScreen"]
+layout_mode = 2
+theme_override_constants/margin_top = 30
+
+[node name="EnterCode" type="LineEdit" parent="OtherScreen/LoginScreen/MarginContainer2"]
+custom_minimum_size = Vector2(0, 30)
+layout_mode = 2
+placeholder_text = "Enter code"
+alignment = 1
+max_length = 4
+
+[node name="PosSpy" type="PanelContainer" parent="."]
+visible = false
+layout_mode = 1
+anchors_preset = -1
+anchor_top = 1.0
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 0
+
+[node name="RichTextLabel" type="RichTextLabel" parent="PosSpy"]
+layout_mode = 2
+bbcode_enabled = true
+text = "[center][color=#f9ddabff]Your location: unreachable[/color][/center]"
+fit_content = true
+
+[node name="PosSpyTimer" type="Timer" parent="."]
+wait_time = 0.5
+autostart = true
+
+[node name="Delivering" type="ColorRect" parent="."]
+visible = false
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+color = Color(0.286275, 0.12549, 0.270588, 1)
+
+[node name="RichTextLabel" type="RichTextLabel" parent="Delivering"]
+layout_mode = 1
+anchors_preset = 8
+anchor_left = 0.5
+anchor_top = 0.5
+anchor_right = 0.5
+anchor_bottom = 0.5
+offset_left = -20.0
+offset_top = -20.0
+offset_right = 20.0
+offset_bottom = 20.0
+grow_horizontal = 2
+grow_vertical = 2
+bbcode_enabled = true
+text = "[font_size=32][color=#f9ddab]Delivering...[/color][/font_size]"
+fit_content = true
+autowrap_mode = 0

BIN
banner.png


+ 34 - 0
banner.png.import

@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://b8fsbj1y78kk2"
+path="res://.godot/imported/banner.png-8ee27b3b5af0c6e04c667908bd5698ae.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://banner.png"
+dest_files=["res://.godot/imported/banner.png-8ee27b3b5af0c6e04c667908bd5698ae.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1

+ 38 - 0
export_presets.cfg

@@ -0,0 +1,38 @@
+[preset.0]
+
+name="Web"
+platform="Web"
+runnable=true
+dedicated_server=false
+custom_features=""
+export_filter="all_resources"
+include_filter=""
+exclude_filter=""
+export_path=""
+encryption_include_filters=""
+encryption_exclude_filters=""
+encrypt_pck=false
+encrypt_directory=false
+script_encryption_key=""
+
+[preset.0.options]
+
+custom_template/debug=""
+custom_template/release=""
+variant/extensions_support=false
+vram_texture_compression/for_desktop=true
+vram_texture_compression/for_mobile=false
+html/export_icon=true
+html/custom_html_shell=""
+html/head_include=""
+html/canvas_resize_policy=2
+html/focus_canvas_on_start=true
+html/experimental_virtual_keyboard=false
+progressive_web_app/enabled=false
+progressive_web_app/offline_page=""
+progressive_web_app/display=1
+progressive_web_app/orientation=0
+progressive_web_app/icon_144x144=""
+progressive_web_app/icon_180x180=""
+progressive_web_app/icon_512x512=""
+progressive_web_app/background_color=Color(0, 0, 0, 1)

File diff suppressed because it is too large
+ 1 - 0
icon.svg


+ 37 - 0
icon.svg.import

@@ -0,0 +1,37 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://w6b00ccbg065"
+path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://icon.svg"
+dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false

+ 7 - 0
ld53-bagelsdelicious.csproj

@@ -0,0 +1,7 @@
+<Project Sdk="Godot.NET.Sdk/4.0.2">
+  <PropertyGroup>
+    <TargetFramework>net6.0</TargetFramework>
+    <EnableDynamicLoading>true</EnableDynamicLoading>
+    <RootNamespace>ld53bagelsdelicious</RootNamespace>
+  </PropertyGroup>
+</Project>

+ 19 - 0
ld53-bagelsdelicious.sln

@@ -0,0 +1,19 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ld53-bagelsdelicious", "ld53-bagelsdelicious.csproj", "{66660F2B-4383-4B81-B698-E445901926B4}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+	Debug|Any CPU = Debug|Any CPU
+	ExportDebug|Any CPU = ExportDebug|Any CPU
+	ExportRelease|Any CPU = ExportRelease|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{66660F2B-4383-4B81-B698-E445901926B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{66660F2B-4383-4B81-B698-E445901926B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{66660F2B-4383-4B81-B698-E445901926B4}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU
+		{66660F2B-4383-4B81-B698-E445901926B4}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU
+		{66660F2B-4383-4B81-B698-E445901926B4}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU
+		{66660F2B-4383-4B81-B698-E445901926B4}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU
+	EndGlobalSection
+EndGlobal

BIN
logo.png


+ 34 - 0
logo.png.import

@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://c3vxfjwswbbps"
+path="res://.godot/imported/logo.png-cca8726399059c8d4f806e28e356b14d.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://logo.png"
+dest_files=["res://.godot/imported/logo.png-cca8726399059c8d4f806e28e356b14d.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1

+ 34 - 0
project.godot

@@ -0,0 +1,34 @@
+; Engine configuration file.
+; It's best edited using the editor UI and not directly,
+; since the parameters that go here are not all obvious.
+;
+; Format:
+;   [section] ; section goes between []
+;   param=value ; assign values to parameters
+
+config_version=5
+
+[application]
+
+config/name="bagelicious.me"
+run/main_scene="res://Bagelicious.tscn"
+config/features=PackedStringArray("4.0", "GL Compatibility")
+config/icon="res://icon.svg"
+
+[dotnet]
+
+project/assembly_name="ld53-bagelsdelicious"
+
+[input]
+
+esc={
+"deadzone": 0.5,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"echo":false,"script":null)
+]
+}
+
+[rendering]
+
+renderer/rendering_method="gl_compatibility"
+renderer/rendering_method.mobile="gl_compatibility"
+environment/defaults/default_clear_color=Color(0.286275, 0.12549, 0.270588, 1)

+ 0 - 0
server/.gdignore


File diff suppressed because it is too large
+ 1036 - 0
server/package-lock.json


+ 16 - 0
server/package.json

@@ -0,0 +1,16 @@
+{
+  "name": "server",
+  "version": "1.0.0",
+  "description": "",
+  "main": "server.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1",
+    "start": "node server.js"
+  },
+  "author": "nairobi",
+  "license": "GPL-3.0",
+  "dependencies": {
+    "express": "^4.18.2",
+    "express-rate-limit": "^6.7.0"
+  }
+}

+ 94 - 0
server/server.js

@@ -0,0 +1,94 @@
+'use strict';
+
+const express = require('express');
+const rateLimit = require('express-rate-limit');
+const db = new Map();
+
+const app = express();
+
+const limiter1 = rateLimit({
+	windowMs: 60 * 1000,
+	max: 300, // Limit each IP to 300 requests per `window`
+	standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers
+	legacyHeaders: false, // Disable the `X-RateLimit-*` headers
+});
+
+const limiter2 = rateLimit({
+	windowMs: 60 * 1000,
+	max: 2, 
+	standardHeaders: true,
+	legacyHeaders: false,
+});
+
+app.use(limiter1);
+
+app.use('/create', limiter2);
+
+app.get('/', (req, res) => {
+    res.sendStatus(403);
+});
+
+app.get('/create', (req, res) => {
+    const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
+    let code = "";
+    do {
+        for(let i = 0; i < 4; i += 1) {
+            code += characters.charAt(Math.floor(Math.random() * characters.length));
+        }
+    } while(db.has(code));
+    // It's a set because it was originally idx-only, too late to change now
+    db.set(code, {
+        x: -1.0,
+        y: -1.0,
+        set: new Set()
+    });
+    res.send(code);
+});
+
+app.get('/verify/:code', (req, res) => {
+    const code = req.params.code.toUpperCase();
+    if(db.has(code)) {
+        res.send(`${code}`);
+    } else {
+        res.sendStatus(404);
+    }
+});
+
+app.get('/order/:code/:bagel/:x/:y', (req, res) => {
+    const code = req.params.code.toUpperCase();
+    if(db.has(code)) {
+        db.get(code).set.add({
+            type: req.params.bagel,
+            x: req.params.x,
+            y: req.params.y
+        });
+        res.send("OK");
+    } else {
+        res.sendStatus(404);
+    }
+});
+
+app.get('/getpos/:code', (req, res) => {
+    const code = req.params.code.toUpperCase();
+    if(db.has(code)) {
+        const {x, y} = db.get(code);
+        res.send({x, y});
+    } else {
+        res.sendStatus(404);
+    }
+});
+
+app.get('/take/:code/:x/:y', (req, res) => {
+    const code = req.params.code.toUpperCase();
+    if(db.has(code)) {
+        db.get(code).x = req.params.x;
+        db.get(code).y = req.params.y;
+        const v = [...db.get(code).set.values()];
+        db.get(code).set.clear();
+        res.send(v);
+    } else {
+        res.sendStatus(404);
+    }
+});
+
+app.listen(42137);