Import current DEMON v0.19 source, assets and development handoff
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
extends RefCounted
|
||||
# One layout for the playable room and the instanced cells in the distance.
|
||||
# All courses meet exactly; only the arrow slits and gate openings are empty.
|
||||
static func layout(left,right,depth,gate_x):
|
||||
var parts=[]
|
||||
for z in [-depth,depth]:
|
||||
wall(parts,Vector3(left,0,z),Vector3.RIGHT,right-left,gate_x-left)
|
||||
for x in [left,right]:
|
||||
wall(parts,Vector3(x,0,-depth),Vector3.BACK,depth*2,-100.0)
|
||||
for x in [left,right]:
|
||||
for z in [-depth,depth]:
|
||||
var first=parts.size();tower(parts,Vector3(x,0,z))
|
||||
for i in range(first,parts.size()):parts[i]["normal"]=Vector3(-1 if x==left else 1,0,signf(z))
|
||||
return parts
|
||||
|
||||
static func add(parts,pos,size,feature):
|
||||
parts.append({"position":pos,"size":size,"feature":feature})
|
||||
|
||||
static func course(parts,start,axis,a,b,bottom,top,feature):
|
||||
if b-a<.001:return
|
||||
var size=Vector3(.46,top-bottom,.46)
|
||||
if axis.x!=0:size.x=b-a
|
||||
else:size.z=b-a
|
||||
add(parts,start+axis*((a+b)*.5)+Vector3.UP*((bottom+top)*.5),size,feature)
|
||||
|
||||
static func wall(parts,start,axis,length,gate):
|
||||
var first=parts.size()
|
||||
var sections=[[0.0,length]]
|
||||
if gate>0 and gate<length:sections=[[0.0,gate-1.02],[gate+1.02,length]]
|
||||
for section in sections:
|
||||
var a=section[0];var b=section[1]
|
||||
# Solid foundation and a continuous cap keep expansion joins closed.
|
||||
course(parts,start,axis,a,b,0,.60,"plinth")
|
||||
course(parts,start,axis,a,b,.60,1.25,"wall")
|
||||
course(parts,start,axis,a,b,1.95,2.5,"wall")
|
||||
var count=maxi(1,roundi((b-a)/1.65));var pitch=(b-a)/count
|
||||
for i in range(count):
|
||||
var center=a+(i+.5)*pitch
|
||||
course(parts,start,axis,a+i*pitch,center-.085,1.25,1.95,"slit_jamb")
|
||||
course(parts,start,axis,center+.085,a+(i+1)*pitch,1.25,1.95,"slit_jamb")
|
||||
# Centered, equally spaced battlements on every corresponding span.
|
||||
var teeth=maxi(1,roundi((b-a)/1.1));var step=(b-a)/teeth
|
||||
for i in range(teeth):
|
||||
var center=a+(i+.5)*step
|
||||
course(parts,start,axis,center-step*.27,center+step*.27,2.5,2.94,"merlon")
|
||||
for i in range(first,parts.size()):parts[i]["normal"]=Vector3(0,0,signf(start.z)) if axis.x!=0 else Vector3(signf(start.x),0,0)
|
||||
|
||||
static func tower(parts,p):
|
||||
add(parts,p+Vector3(0,.16,0),Vector3(1.35,.32,1.35),"tower_base")
|
||||
add(parts,p+Vector3(0,1.58,0),Vector3(1.05,2.52,1.05),"tower")
|
||||
add(parts,p+Vector3(0,2.92,0),Vector3(1.4,.22,1.4),"tower_cap")
|
||||
for x in [-.46,.46]:
|
||||
for z in [-.46,.46]:add(parts,p+Vector3(x,3.23,z),Vector3(.43,.42,.43),"tower_tooth")
|
||||
Reference in New Issue
Block a user