Added delivery quest (very crappy realisation)

This commit is contained in:
gotfishmakesticks 2023-11-21 12:59:19 +03:00
commit c6bf51f1b0
9 changed files with 71 additions and 13 deletions

View file

@ -8,7 +8,7 @@ custom_features=""
export_filter="all_resources" export_filter="all_resources"
include_filter="" include_filter=""
exclude_filter="" exclude_filter=""
export_path="../executables/cosmic/gammacosmicrays ictar1.0.exe" export_path="../executables/cosmic/gammacosmicrays ictar1.1 beta.exe"
encryption_include_filters="" encryption_include_filters=""
encryption_exclude_filters="" encryption_exclude_filters=""
encrypt_pck=false encrypt_pck=false

View file

@ -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="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://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://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://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"] [sub_resource type="SpriteFrames" id="SpriteFrames_7tbqy"]
animations = [{ animations = [{
@ -16,6 +17,9 @@ animations = [{
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": ExtResource("4_4lyow") "texture": ExtResource("4_4lyow")
}, {
"duration": 1.0,
"texture": ExtResource("5_tj884")
}], }],
"loop": true, "loop": true,
"name": &"default", "name": &"default",

View file

@ -15,8 +15,8 @@ var color_enemy
@onready var ship = $MainShip @onready var ship = $MainShip
@onready var bases = $Bases @onready var bases = $Bases
@onready var enemy_faction = $EnemyFaction @onready var enemy_faction = $EnemyFaction
signal enemy_destroyed signal enemy_destroyed
signal scene_ready
func _ready(): func _ready():
randomize() randomize()
@ -60,6 +60,7 @@ func _ready():
if data['got_reward']: if data['got_reward']:
ship.quest.new = true ship.quest.new = true
ship.quest_completed = true ship.quest_completed = true
scene_ready.emit()
func addtargetlist(body : Node2D): func addtargetlist(body : Node2D):
if !can_target.has(body): if !can_target.has(body):

View file

@ -17,6 +17,9 @@ func _on_body_entered(body):
menu_inst.base = get_parent() menu_inst.base = get_parent()
body.find_child("GUI").add_child(menu_inst) body.find_child("GUI").add_child(menu_inst)
body.minimap.visible = false 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): func _on_body_exited(body):
if body is MainShip: if body is MainShip:

View file

@ -11,9 +11,10 @@ var sell_prices : Array[float] = []
var buy_prices : Array[float] = [] var buy_prices : Array[float] = []
var quest : Quest = Quest.new() 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 = { 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(): func _ready():
@ -44,6 +45,9 @@ func _ready():
want_to_buy.append(Game.get_item("Water Barrel")) 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("Energy Cell"))
want_to_buy.append(Game.get_item("Raw Materials")) want_to_buy.append(Game.get_item("Raw Materials"))
get_tree().current_scene.scene_ready.connect(post_ready)
func post_ready():
update_prices() update_prices()
generate_quest() generate_quest()
@ -80,11 +84,17 @@ func generate_quest():
Quest.TYPE.ELIMINATION: Quest.TYPE.ELIMINATION:
progress_max = difficulty * 2 progress_max = difficulty * 2
reward_money = 50 * progress_max * reward_multi 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): if restrictions.has(Quest.RESTRICTIONS.TIMER):
reward_money *= 1.5
data['timer'] = int(difficulty * 30) 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) quest.create(quest_type, progress_max, reward_money, restrictions, data)

View file

@ -46,6 +46,8 @@ func destroy():
func add_quest(quest : Quest): func add_quest(quest : Quest):
if quest.restrictions.has(Quest.RESTRICTIONS.TIMER): if quest.restrictions.has(Quest.RESTRICTIONS.TIMER):
get_tree().create_timer(quest.data['timer']).timeout.connect(timer_failed) 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): func kill_quest(success : bool):
if success: if success:

View file

@ -8,13 +8,17 @@ var type = "hostile"
var tmi = { var tmi = {
"hostile": 0, "hostile": 0,
"base": 1, "base": 1,
"loot": 2 "loot": 2,
"quest": 3
} }
func _ready(): func _ready():
marker.frame = tmi[type] marker.frame = tmi[type]
func _process(_delta): func _process(_delta):
if !is_instance_valid(target):
queue_free()
return
rotation = ship.global_position.angle_to_point(target.global_position) 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) var sp_scale = 1024 / clamp(ship.global_position.distance_to(target.global_position), 512, 2048)
marker.scale = Vector2(sp_scale, sp_scale) marker.scale = Vector2(sp_scale, sp_scale)

BIN
sprites/minimapquest.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

View file

@ -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