From 5776af6ad1e542214056e3c3753427306d9bc921 Mon Sep 17 00:00:00 2001
From: Zoey Kitt <zoey.kitt@outlook.com>
Date: Sat, 16 Nov 2024 13:24:14 -0600
Subject: Print transaction values

---
 scenes/stockticker/Stock Ticker.tscn |  6 +++++-
 scenes/stockticker/stonks.gd         |  9 +++++----
 scenes/stockticker/transactions.gd   | 21 +++++++++++++++++++++
 3 files changed, 31 insertions(+), 5 deletions(-)
 create mode 100644 scenes/stockticker/transactions.gd

(limited to 'scenes')

diff --git a/scenes/stockticker/Stock Ticker.tscn b/scenes/stockticker/Stock Ticker.tscn
index 01388d0..6c0e1fb 100644
--- a/scenes/stockticker/Stock Ticker.tscn	
+++ b/scenes/stockticker/Stock Ticker.tscn	
@@ -1,5 +1,6 @@
-[gd_scene load_steps=10 format=3 uid="uid://g2veoq55y14i"]
+[gd_scene load_steps=11 format=3 uid="uid://g2veoq55y14i"]
 
+[ext_resource type="Script" path="res://scenes/stockticker/transactions.gd" id="1_1gmdn"]
 [ext_resource type="Texture2D" uid="uid://voruypgyi77e" path="res://scenes/stockticker/UI-Background-Colour.png" id="1_wbfee"]
 [ext_resource type="Script" path="res://scenes/stockticker/stonks.gd" id="2_pan4m"]
 [ext_resource type="Theme" uid="uid://ve18rbkeiwti" path="res://UI/text.tres" id="3_dv3dr"]
@@ -11,6 +12,7 @@
 [ext_resource type="Texture2D" uid="uid://dpp7abs35p6i5" path="res://scenes/stockticker/fishe/gar.png" id="9_bv8iw"]
 
 [node name="Node2D" type="Node2D"]
+script = ExtResource("1_1gmdn")
 
 [node name="Background" type="Sprite2D" parent="."]
 modulate = Color(0.796078, 0.796078, 0.796078, 1)
@@ -150,5 +152,7 @@ theme_override_font_sizes/font_size = 82
 text = "GAR"
 
 [connection signal="timeout" from="Timer" to="Stonks" method="_on_timer_timeout"]
+[connection signal="buy" from="Stonks" to="." method="_on_stonks_buy"]
+[connection signal="sell" from="Stonks" to="." method="_on_stonks_sell"]
 [connection signal="button_up" from="Stonks/SellButton" to="Stonks" method="_on_sell_button_button_up"]
 [connection signal="button_up" from="Stonks/BuyButton" to="Stonks" method="_on_buy_button_button_up"]
diff --git a/scenes/stockticker/stonks.gd b/scenes/stockticker/stonks.gd
index 96ea000..d921282 100644
--- a/scenes/stockticker/stonks.gd
+++ b/scenes/stockticker/stonks.gd
@@ -1,6 +1,7 @@
 extends Node2D
 
-signal transaction(amount: float)
+signal buy(amount)
+signal sell(amount)
 
 const MAX_PRICES = 15
 
@@ -19,7 +20,7 @@ var darksouls_text: Label
 
 var price_history = []
 var base_pos_mult = 0.5 # no size limit
-var base_neg_mult = 0.5 # probably keep this below 1
+var base_neg_mult = 100.5 # probably keep this below 1
 
 var hype_mult = 1.0
 var hype_decr = 0.1
@@ -160,7 +161,7 @@ func _on_buy_button_button_up() -> void:
 		shares += 1
 		shares_label.text = "Shares\nHeld:%d" % shares
 		hype_mult += hype_inc
-		transaction.emit(-prev_price)
+		buy.emit(prev_price)
 
 
 func _on_sell_button_button_up() -> void:
@@ -168,4 +169,4 @@ func _on_sell_button_button_up() -> void:
 		shares -= 1
 		shares_label.text = "Shares\nHeld:%d" % shares
 		panic_mult += panic_inc
-		transaction.emit(prev_price)
+		sell.emit(prev_price)
diff --git a/scenes/stockticker/transactions.gd b/scenes/stockticker/transactions.gd
new file mode 100644
index 0000000..c90e473
--- /dev/null
+++ b/scenes/stockticker/transactions.gd
@@ -0,0 +1,21 @@
+extends Node2D
+
+## I need the signal-emitter to be the root node of this scene and when I 
+## tried to just move the script it broke the stonk line so here this is I guess lol
+
+# Called when the node enters the scene tree for the first time.
+func _ready() -> void:
+	pass # Replace with function body.
+
+
+# Called every frame. 'delta' is the elapsed time since the previous frame.
+func _process(delta: float) -> void:
+	pass
+
+
+func _on_stonks_buy(amount: Variant) -> void:
+	print("-$%s" % amount.toString())
+
+
+func _on_stonks_sell(amount: Variant) -> void:
+	print("+$%s" % amount.toString())
-- 
cgit v1.2.3