.
This commit is contained in:
parent
ae50e13c78
commit
60a8bab179
10 changed files with 55 additions and 17 deletions
|
|
@ -3,6 +3,7 @@ extends Node
|
|||
signal productions_update(p: Array[Production])
|
||||
@warning_ignore("unused_signal")
|
||||
signal production_log(producer: Currency, p: Production)
|
||||
signal log(s: String)
|
||||
@export var currencies: Array[Production]
|
||||
@export var members: Array
|
||||
|
||||
|
|
@ -78,11 +79,14 @@ func simulate():
|
|||
update_currencies()
|
||||
for e in events:
|
||||
if e.requirements_satisfied() and e.will_happen():
|
||||
if e.log_message != "" and not e.skip_log:
|
||||
Economy.log.emit(e.log_message)
|
||||
var outcome := e.outcome()
|
||||
for o in outcome:
|
||||
if o == null:
|
||||
continue
|
||||
produce(o)
|
||||
if e.log_message == "" and not e.skip_log:
|
||||
production_log.emit(null, o)
|
||||
if e.timeline != null:
|
||||
GameState.add_letter.emit(e.into_letter())
|
||||
|
|
|
|||
1
event.gd
1
event.gd
|
|
@ -16,6 +16,7 @@ enum EventNature {
|
|||
@export var nature: EventNature = EventNature.Random
|
||||
@export var email_source: Currency = preload("res://currency/sentient/town_crier.tres")
|
||||
@export var email_subject: String = "Something is amok!"
|
||||
@export var log_message: String = ""
|
||||
|
||||
func requirements_satisfied() -> bool:
|
||||
for requirement in requirements:
|
||||
|
|
|
|||
|
|
@ -5,6 +5,19 @@ extends VBoxContainer
|
|||
|
||||
func _ready() -> void:
|
||||
Economy.production_log.connect(append)
|
||||
Economy.log.connect(log)
|
||||
|
||||
func log(s: String):
|
||||
var display := preload("res://gui/production_log.tscn").instantiate()
|
||||
display.set_color(new_message_color)
|
||||
for child in get_children():
|
||||
if child is ProductionLog and child.is_old:
|
||||
child.set_color(old_message_color)
|
||||
display.generic = true
|
||||
display.generic_text = s
|
||||
add_child(display)
|
||||
move_child(display, 0)
|
||||
|
||||
|
||||
func append(producer: Currency, production: Production):
|
||||
var display := preload("res://gui/production_log.tscn").instantiate()
|
||||
|
|
|
|||
|
|
@ -3,14 +3,25 @@ class_name ProductionLog
|
|||
|
||||
@export var producer: Currency = null
|
||||
@export var production: Production
|
||||
@export var generic: bool = false
|
||||
@export var generic_text: String = "<No message>"
|
||||
|
||||
var is_old: bool = false
|
||||
|
||||
func _ready() -> void:
|
||||
if generic:
|
||||
%GenericMessage.visible = true
|
||||
%GenericMessage.text = generic_text
|
||||
%Production.visible = false
|
||||
%Production2.visible = false
|
||||
else:
|
||||
if producer != null:
|
||||
%producer.text = producer.name
|
||||
%GenericMessage.visible = false
|
||||
%Production.visible = true
|
||||
%Production2.visible = false
|
||||
else:
|
||||
%GenericMessage.visible = false
|
||||
%Production.visible = false
|
||||
%Production2.visible = true
|
||||
%amount.text = str(abs(production.amount))
|
||||
|
|
@ -21,7 +32,7 @@ func _ready() -> void:
|
|||
else:
|
||||
%type.text = "consumed "
|
||||
%producer2.text = "You lost "
|
||||
|
||||
if production != null:
|
||||
%production.text = production.currency.name
|
||||
%production2.text = production.currency.name
|
||||
make_old.call_deferred()
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@
|
|||
[node name="ProductionLog" type="MarginContainer" unique_id=253822540]
|
||||
script = ExtResource("1_ei3g1")
|
||||
|
||||
[node name="GenericMessage" type="Label" parent="." unique_id=712313778]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Production" type="HBoxContainer" parent="." unique_id=1073672077]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
[gd_resource type="Resource" script_class="Event" format=3 uid="uid://ddjairvlvswck"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_puqnt"]
|
||||
[ext_resource type="Resource" uid="uid://chsv8oeajty8j" path="res://currency/sentient/town_crier.tres" id="1_unbcn"]
|
||||
[ext_resource type="Resource" uid="uid://b5qok0rcalr" path="res://currency/sentient/cow.tres" id="2_tqpw4"]
|
||||
[ext_resource type="Resource" uid="uid://dsohovjbf3s2p" path="res://currency/sentient/chicken.tres" id="3_unbcn"]
|
||||
[ext_resource type="Resource" uid="uid://rdrcyvuvrp2m" path="res://currency/sentient/pig.tres" id="4_k6ytv"]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
[gd_resource type="Resource" script_class="Event" format=3 uid="uid://s2n6eankt20p"]
|
||||
|
||||
[ext_resource type="Resource" uid="uid://dv834343s36af" path="res://currency/sentient/drunk.tres" id="1_dvejf"]
|
||||
[ext_resource type="Resource" uid="uid://chsv8oeajty8j" path="res://currency/sentient/town_crier.tres" id="1_ilimp"]
|
||||
[ext_resource type="Script" uid="uid://diwdxofo6exg3" path="res://event.gd" id="1_qbpgq"]
|
||||
[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="2_iq8td"]
|
||||
[ext_resource type="Resource" uid="uid://bfc53d345i1h5" path="res://test/bar_crawl.dtl" id="4_iq8td"]
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
[ext_resource type="Script" uid="uid://diwdxofo6exg3" path="res://event.gd" id="1_dxq8u"]
|
||||
[ext_resource type="Resource" uid="uid://by3dayfdpobpt" path="res://currency/inanimate/blood.tres" id="1_jlulm"]
|
||||
[ext_resource type="Resource" uid="uid://chsv8oeajty8j" path="res://currency/sentient/town_crier.tres" id="1_tqf2y"]
|
||||
[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="2_arfor"]
|
||||
[ext_resource type="Resource" uid="uid://ikwdxjpxukej" path="res://test/blood_rain.dtl" id="4_arfor"]
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
[ext_resource type="Resource" uid="uid://clx8tbrad4m7c" path="res://currency/sentient/dinosaur.tres" id="1_0jmdm"]
|
||||
[ext_resource type="Script" uid="uid://diwdxofo6exg3" path="res://event.gd" id="1_sui6i"]
|
||||
[ext_resource type="Resource" uid="uid://chsv8oeajty8j" path="res://currency/sentient/town_crier.tres" id="1_sy7r4"]
|
||||
[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="2_1x1ll"]
|
||||
[ext_resource type="Resource" uid="uid://25iq6i8ltb6v" path="res://test/dino.dtl" id="4_1x1ll"]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
[gd_resource type="Resource" script_class="Event" format=3 uid="uid://vtlqhmhi0yeq"]
|
||||
|
||||
[ext_resource type="Resource" uid="uid://b8b6yr444ecdk" path="res://currency/inanimate/water.tres" id="1_d7ltk"]
|
||||
[ext_resource type="Resource" uid="uid://chsv8oeajty8j" path="res://currency/sentient/town_crier.tres" id="1_unbv5"]
|
||||
[ext_resource type="Script" uid="uid://diwdxofo6exg3" path="res://event.gd" id="1_ut0k2"]
|
||||
[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="2_rh8yf"]
|
||||
[ext_resource type="Resource" uid="uid://damk3l2oj6gkd" path="res://test/drought.dtl" id="4_rh8yf"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue