From c6bf51f1b0d3f5f50bdd1758f1774fd2bdb3cfca Mon Sep 17 00:00:00 2001 From: gotfishmakesticks <80163046+gotfishmakesticks@users.noreply.github.com> Date: Tue, 21 Nov 2023 12:59:19 +0300 Subject: [PATCH] Added delivery quest (very crappy realisation) --- export_presets.cfg | 2 +- scenes/MinimapMarker.tscn | 6 +++++- scripts/Space.gd | 3 ++- scripts/misc/BaseMenuOpen.gd | 3 +++ scripts/objects/Base.gd | 28 +++++++++++++++++-------- scripts/objects/MainShip.gd | 2 ++ scripts/objects/MinimapMarker.gd | 6 +++++- sprites/minimapquest.png | Bin 0 -> 133 bytes sprites/minimapquest.png.import | 34 +++++++++++++++++++++++++++++++ 9 files changed, 71 insertions(+), 13 deletions(-) create mode 100644 sprites/minimapquest.png create mode 100644 sprites/minimapquest.png.import diff --git a/export_presets.cfg b/export_presets.cfg index 29859f3..1a950ea 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -8,7 +8,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="../executables/cosmic/gammacosmicrays ictar1.0.exe" +export_path="../executables/cosmic/gammacosmicrays ictar1.1 beta.exe" encryption_include_filters="" encryption_exclude_filters="" encrypt_pck=false diff --git a/scenes/MinimapMarker.tscn b/scenes/MinimapMarker.tscn index 92577cb..56e70ff 100644 --- a/scenes/MinimapMarker.tscn +++ b/scenes/MinimapMarker.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=6 format=3 uid="uid://c7iafvpoopwc0"] +[gd_scene load_steps=7 format=3 uid="uid://c7iafvpoopwc0"] [ext_resource type="Script" path="res://scripts/objects/MinimapMarker.gd" id="1_j37jj"] [ext_resource type="Texture2D" uid="uid://bavanv7ua7qlx" path="res://sprites/minimaphostile.png" id="2_pfl45"] [ext_resource type="Texture2D" uid="uid://bqn08woclyoj0" path="res://sprites/minimapbase.png" id="3_sgrhe"] [ext_resource type="Texture2D" uid="uid://b1kf1jbsnw2m3" path="res://sprites/minimapbounty.png" id="4_4lyow"] +[ext_resource type="Texture2D" uid="uid://de34fc1qbeajo" path="res://sprites/minimapquest.png" id="5_tj884"] [sub_resource type="SpriteFrames" id="SpriteFrames_7tbqy"] animations = [{ @@ -16,6 +17,9 @@ animations = [{ }, { "duration": 1.0, "texture": ExtResource("4_4lyow") +}, { +"duration": 1.0, +"texture": ExtResource("5_tj884") }], "loop": true, "name": &"default", diff --git a/scripts/Space.gd b/scripts/Space.gd index 4def922..0c4c19c 100644 --- a/scripts/Space.gd +++ b/scripts/Space.gd @@ -15,8 +15,8 @@ var color_enemy @onready var ship = $MainShip @onready var bases = $Bases @onready var enemy_faction = $EnemyFaction - signal enemy_destroyed +signal scene_ready func _ready(): randomize() @@ -60,6 +60,7 @@ func _ready(): if data['got_reward']: ship.quest.new = true ship.quest_completed = true + scene_ready.emit() func addtargetlist(body : Node2D): if !can_target.has(body): diff --git a/scripts/misc/BaseMenuOpen.gd b/scripts/misc/BaseMenuOpen.gd index bc27c8c..9d11666 100644 --- a/scripts/misc/BaseMenuOpen.gd +++ b/scripts/misc/BaseMenuOpen.gd @@ -17,6 +17,9 @@ func _on_body_entered(body): menu_inst.base = get_parent() body.find_child("GUI").add_child(menu_inst) body.minimap.visible = false + if body.quest.type == Quest.TYPE.DELIVERY: + if body.quest.data['destination'] == get_parent(): + body.quest.do_progress() func _on_body_exited(body): if body is MainShip: diff --git a/scripts/objects/Base.gd b/scripts/objects/Base.gd index 63ea1e9..7194b41 100644 --- a/scripts/objects/Base.gd +++ b/scripts/objects/Base.gd @@ -11,9 +11,10 @@ var sell_prices : Array[float] = [] var buy_prices : Array[float] = [] var quest : Quest = Quest.new() -const available_quests : Array[Quest.TYPE]= [Quest.TYPE.ELIMINATION] +const available_quests : Array[Quest.TYPE]= [Quest.TYPE.ELIMINATION, Quest.TYPE.DELIVERY] const restrictions_foreach_type : Dictionary = { - Quest.TYPE.ELIMINATION : [Quest.RESTRICTIONS.NO_DEATHS, Quest.RESTRICTIONS.TIMER] + Quest.TYPE.ELIMINATION : [Quest.RESTRICTIONS.NO_DEATHS, Quest.RESTRICTIONS.TIMER], + Quest.TYPE.DELIVERY : [Quest.RESTRICTIONS.NO_DEATHS, Quest.RESTRICTIONS.NO_WEAPON, Quest.RESTRICTIONS.TIMER] } func _ready(): @@ -44,6 +45,9 @@ func _ready(): want_to_buy.append(Game.get_item("Water Barrel")) want_to_buy.append(Game.get_item("Energy Cell")) want_to_buy.append(Game.get_item("Raw Materials")) + get_tree().current_scene.scene_ready.connect(post_ready) + +func post_ready(): update_prices() generate_quest() @@ -80,11 +84,17 @@ func generate_quest(): Quest.TYPE.ELIMINATION: progress_max = difficulty * 2 reward_money = 50 * progress_max * reward_multi - if restrictions.has(Quest.RESTRICTIONS.NO_DEATHS): - reward_money *= 1.5 - if restrictions.has(Quest.RESTRICTIONS.NO_WEAPON): - reward_money *= 1.5 - if restrictions.has(Quest.RESTRICTIONS.TIMER): - reward_money *= 1.5 - data['timer'] = int(difficulty * 30) + if restrictions.has(Quest.RESTRICTIONS.TIMER): + data['timer'] = int(difficulty * 30) + Quest.TYPE.DELIVERY: + var bases : Array[Node] = get_tree().current_scene.bases.get_children() + bases.erase(self) + data['destination'] = bases.pick_random() + reward_money = 50 + if restrictions.has(Quest.RESTRICTIONS.TIMER): + data['timer'] = int(difficulty * 30) + var reward_multiplier = 1 + for rest in restrictions: + reward_multiplier += 0.5 + reward_money *= reward_multiplier quest.create(quest_type, progress_max, reward_money, restrictions, data) diff --git a/scripts/objects/MainShip.gd b/scripts/objects/MainShip.gd index f62c4e9..2ee8042 100644 --- a/scripts/objects/MainShip.gd +++ b/scripts/objects/MainShip.gd @@ -46,6 +46,8 @@ func destroy(): func add_quest(quest : Quest): if quest.restrictions.has(Quest.RESTRICTIONS.TIMER): get_tree().create_timer(quest.data['timer']).timeout.connect(timer_failed) + if quest.type == Quest.TYPE.DELIVERY: + minimap.add_marker(quest.data['destination'], "quest") func kill_quest(success : bool): if success: diff --git a/scripts/objects/MinimapMarker.gd b/scripts/objects/MinimapMarker.gd index 35ac755..6f4792e 100644 --- a/scripts/objects/MinimapMarker.gd +++ b/scripts/objects/MinimapMarker.gd @@ -8,13 +8,17 @@ var type = "hostile" var tmi = { "hostile": 0, "base": 1, - "loot": 2 + "loot": 2, + "quest": 3 } func _ready(): marker.frame = tmi[type] func _process(_delta): + if !is_instance_valid(target): + queue_free() + return rotation = ship.global_position.angle_to_point(target.global_position) var sp_scale = 1024 / clamp(ship.global_position.distance_to(target.global_position), 512, 2048) marker.scale = Vector2(sp_scale, sp_scale) diff --git a/sprites/minimapquest.png b/sprites/minimapquest.png new file mode 100644 index 0000000000000000000000000000000000000000..364581aa6614bc34ff2ca5dc8ad75429f4e77416 GIT binary patch literal 133 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqjKx9jP7LeL$-D$|>^)r^LnNk_ z_BnDf81gWspZfRz^xLJJkqhTJxrIpF3jh4P#eTuIg%AD)#)S&^xiHu{T|BaC9ZT#- fshgZTt==;)_E2FD{h`1MG>XB~)z4*}Q$iB}pV2E& literal 0 HcmV?d00001 diff --git a/sprites/minimapquest.png.import b/sprites/minimapquest.png.import new file mode 100644 index 0000000..058a11b --- /dev/null +++ b/sprites/minimapquest.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://de34fc1qbeajo" +path="res://.godot/imported/minimapquest.png-d076ee9177bcd2600d555f3fc64ee3c9.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/minimapquest.png" +dest_files=["res://.godot/imported/minimapquest.png-d076ee9177bcd2600d555f3fc64ee3c9.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