extends RefCounted const POP=preload("res://audio/infernal_pop.wav") func build(g,d): var root=d.device var wood=Color("48302f");var iron=Color("292d35");var brass=Color("a58b59") d["special"]={"bubbles":[],"notes":[],"liquid":null,"music":null,"players":[],"speaker_roots":[],"heat":0.0} if d.selected==4: d.special["seat"]=g.box(root,Vector3(0,.62,-.23),Vector3(1.05,.16,.42),wood);d.special.seat.name="ChairSeat" g.box(root,Vector3(0,.025,.71),Vector3(.85,.05,.45),iron) g.box(root,Vector3(0,1.45,-.48),Vector3(1.15,1.55,.18),wood) for x in [-.47,.47]: for z in [-.40,.20]:g.cylinder(root,Vector3(x,.29,z),.075,.58,iron) g.box(root,Vector3(x*1.3,1.06,.05),Vector3(.16,.14,.96),wood) for z in [-.32,.42]:g.line(root,Vector3(x*1.3,.68,z),Vector3(x*1.3,1.05,z),.045,iron) var cuff=preload("res://leather_cuff.gd").make(g,root,Vector3(x*1.3,1.15,.2),.13);cuff.rotation.x=PI/2 for link_index in range(4): var link=g.torus(root,Vector3(x*1.3,1.04-link_index*.12,.2),.12,iron) link.scale=Vector3.ONE*.5;link.rotation.x=PI/2 if link_index%2==0 else 0 for x in [-.23,.23]: var ankle=preload("res://leather_cuff.gd").make(g,root,Vector3(x,.13,.66),.095);ankle.rotation.x=PI/2 g.line(root,Vector3(x,.13,.66),Vector3(x,.35,.38),.025,iron) g.box(root,Vector3(0,1.45,-.34),Vector3(1.08,.075,.04),Color("33241e")) g.box(root,Vector3(0,.91,.12),Vector3(1.08,.075,.045),Color("33241e")) for side in [-1,1]: var speaker_root=Node3D.new();root.add_child(speaker_root);speaker_root.name="InwardFacingSpeaker";speaker_root.position=Vector3(side*1.05,1.05,-.45) var direction=Vector3(0,1.05,.10)-speaker_root.position;speaker_root.rotation.y=atan2(direction.x,direction.z);d.special.speaker_roots.append(speaker_root) g.box(speaker_root,Vector3.ZERO,Vector3(.50,1.20,.50),iron) for y in [-.30,.26]: var speaker=g.cylinder(speaker_root,Vector3(0,y,.27),.19,.045,Color("14141c"));speaker.rotation.x=PI/2 var rim=g.torus(speaker_root,Vector3(0,y,.30),.19,brass);rim.rotation.x=PI/2 g.ball(speaker_root,Vector3(0,y,.31),Vector3(.12,.12,.04),Color("6c4f7d")) for j in range(9):g.line(speaker_root,Vector3(-.15+j*.038,y-.14,.325),Vector3(-.15+j*.038,y+.14,.325),.004,Color("4b4b52")) for j in range(3): var note=g.torus(root,Vector3(side*(.95+j*.10),2.0+j*.18,-.35),.07,Color("b38bd5"));note.hide();d.special.notes.append(note) var music=AudioStreamPlayer3D.new();speaker_root.add_child(music);music.position.z=.31;music.unit_size=4;music.max_distance=16 music.stream=POP.duplicate();music.stream.loop_mode=AudioStreamWAV.LOOP_FORWARD;music.stream.loop_end=int(music.stream.get_length()*music.stream.mix_rate) d.special.players.append(music) d.special.music=d.special.players[0] else: preload("res://cauldron_shell.gd").new().build(g,root) var liquid=preload("res://water_surface.gd").new().build(g,root,1.24,Vector3(0,1.55,0),true) d.special.liquid=liquid g.torus(root,Vector3(0,1.65,0),1.32,brass) for side in [-1,1]: var handle=g.torus(root,Vector3(side*1.48,1.15,0),.30,iron);handle.rotation.z=PI/2 for i in range(12): var a=i*TAU/12 g.ball(root,Vector3(cos(a)*1.38,1.4,sin(a)*1.38),Vector3.ONE*.07,brass) for i in range(16): var bubble=g.ball(root,Vector3.ZERO,Vector3.ONE*.07,Color("c2ddd9"));bubble.hide();d.special.bubbles.append(bubble) d.flame=Node3D.new();root.add_child(d.flame) for i in range(6): var quad=QuadMesh.new();quad.size=Vector2(.8,.6) var fire=MeshInstance3D.new();d.flame.add_child(fire);fire.mesh=quad;fire.position=Vector3(sin(i)*.65,.28,cos(i)*.65);fire.rotation.y=i var mat_fire=ShaderMaterial.new();mat_fire.shader=preload("res://fire.gdshader");fire.material_override=mat_fire var light=OmniLight3D.new();d.flame.add_child(light);light.position.y=.4;light.light_color=Color("ff8139");light.light_energy=1.3;light.omni_range=3 d.flame.hide() static func animate(g,d,dt,active): if not d.has("special"):return var fx=d.special fx.heat=move_toward(fx.heat,1.0 if active else 0.0,dt*.6) for player in fx.players: player.volume_db=-18+linear_to_db(maxf(g.whip_volume,.0001))-(5 if g.dialogue.player.playing else 0) player.stream_paused=g.paused if active and not g.test_mode and not g.capture_mode and not g.muted and g.whip_volume>0: if not player.playing:player.play() else:player.stop() for i in range(fx.notes.size()): fx.notes[i].visible=active fx.notes[i].position.y=2.0+fposmod(g.time*.65+i*.21,.8) if d.selected==5: for steam in d.device.get_children(): if steam is MeshInstance3D and steam.material_override is ShaderMaterial and steam.material_override.shader==preload("res://steam.gdshader"): steam.material_override.set_shader_parameter("simulation_time",g.time);steam.material_override.set_shader_parameter("heat",fx.heat) if fx.liquid: fx.liquid.material_override.set_shader_parameter("heat",fx.heat) fx.liquid.material_override.set_shader_parameter("simulation_time",g.time) for i in range(fx.bubbles.size()): var t=fposmod(g.time*.7+i*.071,1.0) var bubble=fx.bubbles[i];bubble.visible=fx.heat>.1 bubble.position=Vector3(sin(i*2.4)*.95,1.62+sin(t*PI)*.20*fx.heat,cos(i*2.4)*.95) bubble.scale=Vector3.ONE*(.035+sin(t*PI)*.045)*fx.heat