Merge branch 'master' of https://git.sjkillen.ca/sjkillen/everything_has_a_price_jam
This commit is contained in:
commit
fe8ae84ce1
11 changed files with 99 additions and 32 deletions
|
|
@ -40,6 +40,11 @@ func _unhandled_input(event: InputEvent):
|
||||||
zoom.y = 1
|
zoom.y = 1
|
||||||
else:
|
else:
|
||||||
zoom.y -= 1
|
zoom.y -= 1
|
||||||
|
if UserContext.modal_command is MoveCommand and event.button_index == MOUSE_BUTTON_LEFT and UserContext.selected_member != null:
|
||||||
|
var loc = get_global_mouse_position()
|
||||||
|
var node := Node2D.new()
|
||||||
|
node.name = "targetNode"
|
||||||
|
node.top_level = true
|
||||||
|
node.position = loc
|
||||||
|
self.add_child(node)
|
||||||
|
UserContext.select_point(node)
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,14 @@
|
||||||
[ext_resource type="Resource" uid="uid://dfbgxc6nlcjct" path="res://allegiance/bad.tres" id="4_sitmf"]
|
[ext_resource type="Resource" uid="uid://dfbgxc6nlcjct" path="res://allegiance/bad.tres" id="4_sitmf"]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_riqys"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_riqys"]
|
||||||
size = Vector2(98, 100)
|
size = Vector2(99, 97.67441)
|
||||||
|
|
||||||
[node name="CharacterBody2D" type="CharacterBody2D" unique_id=1581641385]
|
[node name="CharacterBody2D" type="CharacterBody2D" unique_id=1581641385]
|
||||||
|
scale = Vector2(0.215, 0.215)
|
||||||
script = ExtResource("1_xfhet")
|
script = ExtResource("1_xfhet")
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1841709482]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1841709482]
|
||||||
position = Vector2(50, 49)
|
position = Vector2(50.500004, 48.837223)
|
||||||
shape = SubResource("RectangleShape2D_riqys")
|
shape = SubResource("RectangleShape2D_riqys")
|
||||||
|
|
||||||
[node name="MemberSprite" parent="." unique_id=283117283 instance=ExtResource("2_v0at3")]
|
[node name="MemberSprite" parent="." unique_id=283117283 instance=ExtResource("2_v0at3")]
|
||||||
|
|
|
||||||
|
|
@ -22,3 +22,6 @@ func _on_mouse_exited() -> void:
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
|
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
|
||||||
UserContext.select_focused_member()
|
UserContext.select_focused_member()
|
||||||
|
|
||||||
|
func get_allegiance():
|
||||||
|
return allegiance.kingdom_name
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ extends Node
|
||||||
signal productions_update(p: Array[Production])
|
signal productions_update(p: Array[Production])
|
||||||
@warning_ignore("unused_signal")
|
@warning_ignore("unused_signal")
|
||||||
signal production_log(producer: Currency, p: Production)
|
signal production_log(producer: Currency, p: Production)
|
||||||
|
signal log(s: String)
|
||||||
@export var currencies: Array[Production]
|
@export var currencies: Array[Production]
|
||||||
@export var members: Array
|
@export var members: Array
|
||||||
|
|
||||||
|
|
@ -78,12 +79,15 @@ func simulate():
|
||||||
update_currencies()
|
update_currencies()
|
||||||
for e in events:
|
for e in events:
|
||||||
if e.requirements_satisfied() and e.will_happen():
|
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()
|
var outcome := e.outcome()
|
||||||
for o in outcome:
|
for o in outcome:
|
||||||
if o == null:
|
if o == null:
|
||||||
continue
|
continue
|
||||||
produce(o)
|
produce(o)
|
||||||
production_log.emit(null, o)
|
if e.log_message == "" and not e.skip_log:
|
||||||
|
production_log.emit(null, o)
|
||||||
if e.timeline != null:
|
if e.timeline != null:
|
||||||
GameState.add_letter.emit(e.into_letter())
|
GameState.add_letter.emit(e.into_letter())
|
||||||
if randf() < 0.01:
|
if randf() < 0.01:
|
||||||
|
|
|
||||||
1
event.gd
1
event.gd
|
|
@ -16,6 +16,7 @@ enum EventNature {
|
||||||
@export var nature: EventNature = EventNature.Random
|
@export var nature: EventNature = EventNature.Random
|
||||||
@export var email_source: Currency = preload("res://currency/sentient/town_crier.tres")
|
@export var email_source: Currency = preload("res://currency/sentient/town_crier.tres")
|
||||||
@export var email_subject: String = "Something is amok!"
|
@export var email_subject: String = "Something is amok!"
|
||||||
|
@export var log_message: String = ""
|
||||||
|
|
||||||
func requirements_satisfied() -> bool:
|
func requirements_satisfied() -> bool:
|
||||||
for requirement in requirements:
|
for requirement in requirements:
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,19 @@ extends VBoxContainer
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
Economy.production_log.connect(append)
|
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):
|
func append(producer: Currency, production: Production):
|
||||||
var display := preload("res://gui/production_log.tscn").instantiate()
|
var display := preload("res://gui/production_log.tscn").instantiate()
|
||||||
|
|
|
||||||
|
|
@ -3,27 +3,38 @@ class_name ProductionLog
|
||||||
|
|
||||||
@export var producer: Currency = null
|
@export var producer: Currency = null
|
||||||
@export var production: Production
|
@export var production: Production
|
||||||
|
@export var generic: bool = false
|
||||||
|
@export var generic_text: String = "<No message>"
|
||||||
|
|
||||||
var is_old: bool = false
|
var is_old: bool = false
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
if producer != null:
|
if generic:
|
||||||
%producer.text = producer.name
|
%GenericMessage.visible = true
|
||||||
%Production.visible = true
|
%GenericMessage.text = generic_text
|
||||||
|
%Production.visible = false
|
||||||
%Production2.visible = false
|
%Production2.visible = false
|
||||||
else:
|
else:
|
||||||
%Production.visible = false
|
if producer != null:
|
||||||
%Production2.visible = true
|
%producer.text = producer.name
|
||||||
%amount.text = str(abs(production.amount))
|
%GenericMessage.visible = false
|
||||||
%amount2.text = str(abs(production.amount))
|
%Production.visible = true
|
||||||
if production.amount > 0:
|
%Production2.visible = false
|
||||||
%type.text = "produced "
|
else:
|
||||||
%producer2.text = "You gained "
|
%GenericMessage.visible = false
|
||||||
else:
|
%Production.visible = false
|
||||||
%type.text = "consumed "
|
%Production2.visible = true
|
||||||
%producer2.text = "You lost "
|
%amount.text = str(abs(production.amount))
|
||||||
|
%amount2.text = str(abs(production.amount))
|
||||||
%production.text = production.currency.name
|
if production.amount > 0:
|
||||||
%production2.text = production.currency.name
|
%type.text = "produced "
|
||||||
|
%producer2.text = "You gained "
|
||||||
|
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()
|
make_old.call_deferred()
|
||||||
|
|
||||||
func make_old():
|
func make_old():
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,10 @@
|
||||||
[node name="ProductionLog" type="MarginContainer" unique_id=253822540]
|
[node name="ProductionLog" type="MarginContainer" unique_id=253822540]
|
||||||
script = ExtResource("1_ei3g1")
|
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]
|
[node name="Production" type="HBoxContainer" parent="." unique_id=1073672077]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
|
||||||
8
map.tscn
8
map.tscn
|
|
@ -170,14 +170,14 @@ currency = ExtResource("4_gqbix")
|
||||||
allegiance = ExtResource("5_71pa8")
|
allegiance = ExtResource("5_71pa8")
|
||||||
|
|
||||||
[node name="CharacterBody2D2" parent="." unique_id=559452664 instance=ExtResource("3_e0an3")]
|
[node name="CharacterBody2D2" parent="." unique_id=559452664 instance=ExtResource("3_e0an3")]
|
||||||
position = Vector2(628, 935)
|
position = Vector2(854, 34)
|
||||||
|
|
||||||
[node name="MemberSprite" parent="CharacterBody2D2" index="1" unique_id=283117283]
|
[node name="MemberSprite" parent="CharacterBody2D2" index="1" unique_id=283117283]
|
||||||
currency = ExtResource("4_iw27f")
|
currency = ExtResource("4_iw27f")
|
||||||
allegiance = ExtResource("5_71pa8")
|
allegiance = ExtResource("5_71pa8")
|
||||||
|
|
||||||
[node name="CharacterBody2D3" parent="." unique_id=1323337635 instance=ExtResource("3_e0an3")]
|
[node name="CharacterBody2D3" parent="." unique_id=1323337635 instance=ExtResource("3_e0an3")]
|
||||||
position = Vector2(1129, 814)
|
position = Vector2(905, 42)
|
||||||
|
|
||||||
[node name="MemberSprite" parent="CharacterBody2D3" index="1" unique_id=283117283]
|
[node name="MemberSprite" parent="CharacterBody2D3" index="1" unique_id=283117283]
|
||||||
allegiance = ExtResource("5_71pa8")
|
allegiance = ExtResource("5_71pa8")
|
||||||
|
|
@ -242,13 +242,13 @@ position = Vector2(368, -1353)
|
||||||
currency = ExtResource("6_05x41")
|
currency = ExtResource("6_05x41")
|
||||||
|
|
||||||
[node name="CharacterBody2D12" parent="." unique_id=2114526449 instance=ExtResource("3_e0an3")]
|
[node name="CharacterBody2D12" parent="." unique_id=2114526449 instance=ExtResource("3_e0an3")]
|
||||||
position = Vector2(388, -1138)
|
position = Vector2(853, -17.999998)
|
||||||
|
|
||||||
[node name="MemberSprite" parent="CharacterBody2D12" index="1" unique_id=283117283]
|
[node name="MemberSprite" parent="CharacterBody2D12" index="1" unique_id=283117283]
|
||||||
currency = ExtResource("8_oysan")
|
currency = ExtResource("8_oysan")
|
||||||
|
|
||||||
[node name="CharacterBody2D13" parent="." unique_id=799583982 instance=ExtResource("3_e0an3")]
|
[node name="CharacterBody2D13" parent="." unique_id=799583982 instance=ExtResource("3_e0an3")]
|
||||||
position = Vector2(679, -1035)
|
position = Vector2(905.99994, -11.999985)
|
||||||
|
|
||||||
[node name="MemberSprite" parent="CharacterBody2D13" index="1" unique_id=283117283]
|
[node name="MemberSprite" parent="CharacterBody2D13" index="1" unique_id=283117283]
|
||||||
currency = ExtResource("4_iw27f")
|
currency = ExtResource("4_iw27f")
|
||||||
|
|
|
||||||
30
troup.gd
30
troup.gd
|
|
@ -1,11 +1,12 @@
|
||||||
extends CharacterBody2D
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
|
||||||
const SPEED = 100.0
|
const SPEED = 700.0
|
||||||
const JUMP_VELOCITY = -400.0
|
const JUMP_VELOCITY = -400.0
|
||||||
@export var target : Node2D
|
@export var target : Node2D
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
|
||||||
UserContext. set_target_for . connect(set_target_for)
|
UserContext. set_target_for . connect(set_target_for)
|
||||||
|
|
||||||
func set_target_for(who: CurrencyMemberSprite, t: Node2D):
|
func set_target_for(who: CurrencyMemberSprite, t: Node2D):
|
||||||
|
|
@ -19,6 +20,18 @@ func set_target_for(who: CurrencyMemberSprite, t: Node2D):
|
||||||
func removed_target():
|
func removed_target():
|
||||||
target = null
|
target = null
|
||||||
|
|
||||||
|
func combat(target):
|
||||||
|
var winner = randf_range(0,2)
|
||||||
|
print(winner)
|
||||||
|
if winner <= 1:
|
||||||
|
target.queue_free()
|
||||||
|
else:
|
||||||
|
var p := Production.new()
|
||||||
|
p.amount = -1
|
||||||
|
p.currency = %MemberSprite.currency
|
||||||
|
Economy.produce(p)
|
||||||
|
|
||||||
|
self.queue_free()
|
||||||
|
|
||||||
#func _Direction() -> Vector2:
|
#func _Direction() -> Vector2:
|
||||||
#self.position = self.position.move_toward(target.transform.position, speed * delta)
|
#self.position = self.position.move_toward(target.transform.position, speed * delta)
|
||||||
|
|
@ -30,12 +43,19 @@ func _physics_process(delta: float) -> void:
|
||||||
#print(num)
|
#print(num)
|
||||||
var direction = (target.global_position - self.global_position).normalized() * SPEED * delta
|
var direction = (target.global_position - self.global_position).normalized() * SPEED * delta
|
||||||
#if (num > Vector2(2,2)):
|
#if (num > Vector2(2,2)):
|
||||||
if (self.global_position.distance_to(target.global_position) > 0.2):
|
if (self.global_position.distance_to(target.global_position) > 25):
|
||||||
self.velocity = direction
|
self.velocity = direction
|
||||||
#self.global_position = self.global_position.move_toward(target.global_position, SPEED * delta)
|
#self.global_position = self.global_position.move_toward(target.global_position, SPEED * delta)
|
||||||
elif (target.is_class("SentientCurrency")):
|
elif (target.is_class("CharacterBody2D")):
|
||||||
pass
|
print("is SentientCurrency")
|
||||||
|
print(target.name)
|
||||||
|
print(target.get_node("MemberSprite").get_allegiance())
|
||||||
|
if (target.get_node("MemberSprite").get_allegiance() != get_node("MemberSprite").get_allegiance() ):
|
||||||
|
#print("different Allegience: "+ target.get_node("CurrencyMemberSprite").alligence)
|
||||||
|
combat(target)
|
||||||
|
removed_target()
|
||||||
else:
|
else:
|
||||||
pass
|
print("Removed Target")
|
||||||
|
removed_target()
|
||||||
#target = null
|
#target = null
|
||||||
move_and_slide()
|
move_and_slide()
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,11 @@ func select_focused_member():
|
||||||
selected_member_change.emit(selected_member)
|
selected_member_change.emit(selected_member)
|
||||||
UserContext.member_inspect.emit(selected_member)
|
UserContext.member_inspect.emit(selected_member)
|
||||||
|
|
||||||
|
func select_point(node : Node2D):
|
||||||
|
if modal_command is MoveCommand:
|
||||||
|
set_target_for.emit(selected_member, node)
|
||||||
|
|
||||||
|
|
||||||
func unselect_member():
|
func unselect_member():
|
||||||
if selected_member == null:
|
if selected_member == null:
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue