Files

79 lines
3.8 KiB
GDScript
Raw Permalink Normal View History

extends RefCounted
func shot(g,name):
await g.get_tree().create_timer(.55).timeout
await RenderingServer.frame_post_draw
var folder="res://captures/v013" if OS.has_feature("editor") else OS.get_executable_path().get_base_dir()+"/captures/v013"
DirAccess.make_dir_recursive_absolute(folder)
var error=g.get_viewport().get_texture().get_image().save_png(folder+"/"+name+".png")
if error!=OK:push_error("Capture failed");g.get_tree().quit(1);return
print("CAPTURE: "+name)
func clear_souls(g):
for s in g.souls:s.node.queue_free()
g.souls.clear()
for d in g.workshop.stations:d.soul=-1;d.ready=false;d.operator=-1;d.bar.hide()
func soul(g,required):
g.workshop.spawn();var s=g.souls.back();s.entering=false;s.entry_time=1;s.required=required;s.served=[]
g.set_soul_reveal(s.visual,1);g.workshop.sentences.update_label(s)
return s
func run(g):
await g.get_tree().create_timer(.4).timeout
await shot(g,"main-menu")
g.menu.show_settings("main");await shot(g,"settings");g.menu.back()
g.start_game();clear_souls(g);g.coins=5000;g.development.xp=300
if is_instance_valid(g.life.hero_bubble):g.life.hero_bubble.queue_free();g.life.hero_bubble=null
var w=g.workshop;w.unlock=5
w.add_station(0,Vector3(-1,0,3))
w.add_station(2,Vector3(1,0,-1.5))
w.add_station(4,Vector3(4.5,0,1.5))
w.add_station(5,Vector3(8,0,-1));w.rebuild_nav();w.add_helper();w.helpers[0].state="review";w.refresh()
await shot(g,"minimal-hud")
w.toggle_build();w.begin_purchase(4);w.rotate_pending(1)
w.pointer_position=g.camera.unproject_position(Vector3(8.5,.18,3.5));w.update_preview()
await shot(g,"construction")
w.cancel_placement();w.click_station(2);await shot(g,"device-actions")
w.toggle_build();w.toggle_tree();await shot(g,"grimoire")
w.tree.find_children("*","ScrollContainer",true,false)[0].scroll_vertical=240
await shot(g,"grimoire-arsenal");w.toggle_tree()
var a=soul(g,[0,2]);w.attach(a,0);w.step_station(w.stations[0],1,false)
for i in range(5):w.step_station(w.stations[0],.5,true)
var b=soul(g,[4,5]);w.attach(b,2);w.step_station(w.stations[2],1,false);w.step_station(w.stations[2],2,true)
var c=soul(g,[5]);w.attach(c,3);w.step_station(w.stations[3],1,false);w.step_station(w.stations[3],3,true)
w.dialogue_clock=w.DIALOGUE_INTERVAL;w.announce_soul(a,"Я на два пункта не подписывался!")
await shot(g,"sentences-dialogues")
g.paused=true;g.camera.size=10;g.camera.position=Vector3(14,13,14);g.camera.look_at(Vector3(6,1.1,.5))
await shot(g,"new-apparatus")
clear_souls(g);g.paused=false;g.camera.size=20;g.orbit.update(1)
for i in range(7):w.spawn()
for i in range(720):g.time+=1.0/60;w.update(1.0/60)
await shot(g,"queue-pressure")
await apparatus_gallery(g)
print("CAPTURE_BUILD: "+g.build_id)
g.get_tree().quit()
func apparatus_gallery(g):
var w=g.workshop;clear_souls(g)
for d in w.stations:w.dispose_station(d)
w.stations.clear();w.bars.clear()
for h in w.helpers:h.root.hide()
g.player.hide();g.paused=true
for kind in [0,1,2,4,5]:
var d=w.add_station(kind,Vector3(3,0,1))
var s=soul(g,[kind, (kind+1)%6]);w.attach(s,w.stations.size()-1);w.step_station(d,.5,false);s.node.position=d.device.position
for i in range(45):
g.time+=.016;s.visual.update_torture(.016,true);g.working=s.id;g.STATION=d.device.position;d.motion.update(.016,true);w.EXTRA.animate(g,d,.016,true)
g.working=-1
if kind==0:
s.visual.whip_reaction();s.visual.update_torture(.025,true)
preload("res://whip_impact.gd").new().play(g,d.device,s.visual)
g.camera.size=4.8;g.camera.position=d.device.position+Vector3(4,3.5,5);g.camera.look_at(d.device.position+Vector3(0,1.2,0));w.sentences.update_icons()
await shot(g,"apparatus-%d"%kind)
clear_souls(g);w.dispose_station(d);w.stations.erase(d)
for fx in g.get_children():
if fx.has_meta("whip_impact"):fx.queue_free()
await g.get_tree().process_frame