Guzik w debug

This commit is contained in:
Tomasz Boruc 2026-10-20 19:57:00 +02:00
parent 1e5e2cf1e2
commit d9b323b3c7
3 changed files with 60 additions and 10 deletions

View File

@ -0,0 +1,51 @@
extends RefCounted
const MATERIALS := 10000
const CREDITS := 1000000
const DEUTER := 1000000
const CRYSTALS := 10000
const SAMPLES := 1000
const ORBS := 25
const LEARNING_POINTS := 100
const AMMUNITION := 10000
const RADIATION_AMMUNITION := 1000
const MISSILES := 1000
const POWERBANKS := 100
const TOOLTIP := "+1 000 000 kredytów i deuteru\n+10 000 każdego minerału, części i kryształów czasu\n+1000 próbek, +25 każdego orba, +100 punktów nauki\n+10 000 amunicji, +1000 radiacyjnej i rakiet, +100 powerbanków\nMapy: poziomy 2, obecny +1/+5, 120, 125 i 130 (bez duplikatów)\nPo 1 każdego rodzaju wyposażenia do magazynu fregaty oraz sprzęt kapitana."
static func grant(captain: Resource, inventory: Node, level: int) -> Dictionary:
var progress: Resource = captain.expedition
var target_level := clampi(level,1,1000)
for material in preload("res://scripts/planets/planet_rewards.gd").MATERIAL_KEYS:
if material != "parts": captain.minerals[material] = int(captain.minerals.get(material,0))+MATERIALS
captain.parts += MATERIALS
captain.credits += CREDITS
captain.learning_points += LEARNING_POINTS
captain.prepare_skill_offers()
progress.deuter += DEUTER
progress.time_crystals += CRYSTALS
progress.analysis_samples += SAMPLES
for orb in preload("res://scripts/items/special_orbs.gd").IDS:
progress.orbs[orb] = int(progress.orbs.get(orb,0))+ORBS
var new_maps := 0
for destination in [2,maxi(2,level+1),maxi(2,level+5),120,125,130]:
var id := "debug:sector:%d" % destination
if progress.distant_maps.has(id): continue
progress.distant_maps[id] = {"id":id,"level":destination,"seed":maxi(1,id.hash()),"source_level":maxi(1,destination-1),"source_planet":"Pakiet DEBUG","name":"DEBUG · sektor %03d" % destination}
new_maps += 1
var generator := preload("res://scripts/items/item_generator.gd")
for definition in generator.DEFINITIONS:
progress.freighter_storage.append(generator.generate_for_definition(definition,target_level,2))
var gear := preload("res://scripts/planets/captain_equipment.gd")
for kind in gear.KINDS:
captain.gear_items.append({"uid":captain.gear_next_uid,"kind":kind,"level":target_level})
captain.gear_next_uid += 1
if inventory != null:
inventory.ammunition += AMMUNITION
inventory.irradiated_ammunition += RADIATION_AMMUNITION
inventory.missile_ammunition += MISSILES
inventory.energy_banks += POWERBANKS
inventory.ammunition_changed.emit()
inventory.inventory_changed.emit()
progress.emit_changed()
captain.emit_changed()
return {"maps_added":new_maps,"equipment_added":generator.DEFINITIONS.size(),"gear_added":gear.KINDS.size()}

View File

@ -0,0 +1 @@
uid://dpo3bdr2sas3f

View File

@ -148,8 +148,8 @@ func _create_sidebar() -> void:
_debug_actions.add_child(_debug_item_button)
var resources_button := Button.new()
resources_button.name = "AddResources"
resources_button.text = "Dodaj surowce"
resources_button.tooltip_text = "+100 każdego surowca kosmicznego i planetarnego, +100 próbek i +100 części"
resources_button.text = "Dodaj wszystko"
resources_button.tooltip_text = preload("res://scripts/game/debug_rewards.gd").TOOLTIP
resources_button.custom_minimum_size.y = 36
preload("res://scripts/ui/hud_button_style.gd").apply(resources_button, Color("79cba8"))
resources_button.pressed.connect(_give_debug_resources)
@ -407,14 +407,12 @@ func _toggle_debug() -> void:
_layout_debug()
func _give_debug_resources() -> void:
var captain: Resource = GameState.captain
for material in preload("res://scripts/planets/planet_rewards.gd").MATERIAL_KEYS:
if material == "parts": continue
captain.minerals[material] = int(captain.minerals.get(material, 0)) + 100
captain.parts += 100
captain.expedition.analysis_samples += 100
captain.expedition.emit_changed()
captain.emit_changed()
var inventory := player.get_node("ShipInventory") as ShipInventory
var result := preload("res://scripts/game/debug_rewards.gd").grant(GameState.captain,inventory,GameState.system_level)
_debug_item_status.show()
_debug_item_status.text = "Dodano pełny pakiet zasobów, amunicję, wszystkie orby i %d map.\n%d przedmiotów czeka w magazynie fregaty; dodano też sprzęt kapitana i punkty nauki." % [result.maps_added,result.equipment_added]
_debug_item_status.add_theme_color_override("font_color",Color("a9ef83"))
_layout_debug.call_deferred()
func _give_debug_ammunition() -> void:
var inventory := player.get_node("ShipInventory") as ShipInventory