PUSH is a fourth always-available active skill bound to L (gamepad RT). It shoves visible enemies in a 6 m radius outward, damages them and holds them in a 0.55 s stagger that stops chasing and attacks. Autoplay toggling moves to Tab so the new key is free. The effect reuses the rock-debris pool via a new radial burst variant and the shattered-concrete GLB rebuilt in Blender: broken slabs, raised splinters, bent rebar and Hiss cracks. Warm rings, ground pulse, sparks and tumbling GLB shards carry the shockwave; stagger feeds the actor recoil shader. HUD, docs and skill tests updated.
394 lines
16 KiB
Python
394 lines
16 KiB
Python
# tools/blender/build_props.py
|
|
# FBC: NIGHT SHIFT — props / Objects of Power kit (S11).
|
|
#
|
|
# Run inside Blender 5.x:
|
|
# exec(open("/home/dandovlatov/Documents/cntrl/tools/blender/build_props.py").read())
|
|
#
|
|
# Sculpted, ~1k-triangle set pieces for the Oldest House arena: the Hotline,
|
|
# Benicoff TV, Service Weapon pedestal, Rubber Duck, filing cabinet, supply
|
|
# crate and a Hiss-corrupted floating slab. Each exports as one GLB with one
|
|
# merged mesh / material, using the same painted-vertex path as the actors.
|
|
|
|
import math
|
|
import os
|
|
import random
|
|
import sys
|
|
|
|
import bpy
|
|
from mathutils import Euler, Vector
|
|
|
|
REPO = "/home/dandovlatov/Documents/cntrl"
|
|
MODEL_DIR = os.path.join(REPO, "assets", "models", "props")
|
|
BLEND_DIR = os.path.join(REPO, "assets", "blender")
|
|
CONCEPT_DIR = os.path.join(REPO, "docs", "concept")
|
|
for d in (MODEL_DIR, BLEND_DIR, CONCEPT_DIR):
|
|
os.makedirs(d, exist_ok=True)
|
|
|
|
sys.path.insert(0, os.path.join(REPO, "tools", "blender"))
|
|
import importlib
|
|
import actor_kit as K
|
|
importlib.reload(K)
|
|
|
|
K.clear_scene()
|
|
P = K.PALETTE
|
|
P.update({"plastic": "#2a2d33", "screen": "#10151c", "duck": "#f2c230",
|
|
"brass": "#b89348", "glass": "#9fc4cf",
|
|
"concrete_lt": "#9d9c96", "concrete_mid": "#6f7072",
|
|
"concrete_warm": "#b7a184"})
|
|
|
|
|
|
def place(obj, rot=(0.0, 0.0, 0.0), offset=(0.0, 0.0, 0.0)):
|
|
"""Rotate/translate a finished painted part about the prop origin."""
|
|
mat = Euler(rot).to_matrix()
|
|
shift = Vector(offset)
|
|
for v in obj.data.vertices:
|
|
v.co = shift + mat @ v.co
|
|
obj.data.update()
|
|
return obj
|
|
|
|
|
|
# ------------------------------------------------------------------- hotline
|
|
def build_hotline():
|
|
r = K.new_actor("Hotline")
|
|
K.loft(r, "table_top", [
|
|
{"z": 0.84, "r": (0.78, 0.55), "n": 14},
|
|
{"z": 0.89, "r": (0.79, 0.56), "n": 14, "fold": (0.015, 6)},
|
|
{"z": 0.94, "r": (0.80, 0.57), "n": 14},
|
|
], P["plastic"])
|
|
for sx in (-1, 1):
|
|
for sy in (-1, 1):
|
|
K.tube(r, "leg_%d_%d" % (sx, sy),
|
|
[(sx * 0.55, sy * 0.36, 0.02),
|
|
(sx * 0.58, sy * 0.38, 0.84)], [0.055, 0.045],
|
|
P["steel_dk"], sides=6)
|
|
K.plate(r, "drawer", K.octagon(0.40, 0.18), 0.70, 0.83, 0.94,
|
|
P["redaction"], shift=(0, -0.42))
|
|
K.tube(r, "drawer_pull", [(-0.14, -0.52, 0.76), (0.14, -0.52, 0.76)],
|
|
[0.02, 0.02], P["brass"], sides=6)
|
|
K.blob(r, "phone_base", (0, 0, 1.04), (0.30, 0.22, 0.09),
|
|
P["hiss"], subdiv=3, seed=1, ao=0.05)
|
|
K.tube(r, "handset",
|
|
[(-0.30, -0.02, 1.19), (-0.16, -0.14, 1.22),
|
|
(0.16, -0.14, 1.22), (0.30, -0.02, 1.19)],
|
|
[0.055, 0.05, 0.05, 0.055], P["hiss"], sides=10)
|
|
K.ring(r, "dial", (0, -0.10, 1.135), 0.11, 0.018, P["redaction"],
|
|
segments=10)
|
|
for i in range(10):
|
|
a = 2.0 * math.pi * i / 10
|
|
K.crystal(r, "dial_hole_%d" % i,
|
|
(math.cos(a) * 0.10, -0.10 + math.sin(a) * 0.10, 1.14),
|
|
0.022, P["redaction"], sides=4, seed=10 + i)
|
|
K.crystal(r, "indicator", (0.20, -0.16, 1.13), 0.045,
|
|
P["hiss_hot"], sides=5, seed=3)
|
|
K.tube(r, "cord",
|
|
[(0.30, -0.02, 1.19), (0.40, -0.22, 1.06),
|
|
(0.24, -0.40, 0.98), (0.05, -0.32, 1.04)],
|
|
[0.014, 0.012, 0.012, 0.012], P["redaction"], sides=5)
|
|
return r
|
|
|
|
|
|
# ------------------------------------------------------------------------ tv
|
|
def build_tv():
|
|
r = K.new_actor("BenicoffTV")
|
|
K.loft(r, "stand", [
|
|
{"z": 0.02, "r": (0.72, 0.50), "n": 10},
|
|
{"z": 0.52, "r": (0.68, 0.47), "n": 10},
|
|
{"z": 0.58, "r": (0.74, 0.52), "n": 10},
|
|
], P["plastic"], ao=0.10)
|
|
K.loft(r, "body", [
|
|
{"z": 0.58, "r": (0.62, 0.40), "n": 14},
|
|
{"z": 0.85, "r": (0.65, 0.42), "n": 14},
|
|
{"z": 1.05, "r": (0.66, 0.43), "n": 14},
|
|
{"z": 1.36, "r": (0.66, 0.43), "n": 14},
|
|
{"z": 1.70, "r": (0.66, 0.43), "n": 14},
|
|
{"z": 1.84, "r": (0.58, 0.38), "n": 14},
|
|
], P["plastic"], ao=0.06)
|
|
screen = K.plate(r, "screen", K.octagon(0.50, 0.36), 0.0, 0.015, 1.0,
|
|
P["screen"], ao=0.0)
|
|
place(screen, rot=(math.pi / 2, 0, 0), offset=(0, -0.445, 1.34))
|
|
bezel = K.ring(r, "bezel", (0, 0, 0), 0.50, 0.025,
|
|
P["steel_dk"], segments=16)
|
|
place(bezel, rot=(math.pi / 2, 0, 0), offset=(0, -0.45, 1.34))
|
|
K.tube(r, "antenna_l",
|
|
[(0.20, 0.10, 1.84), (0.42, 0.12, 2.30)],
|
|
[0.016, 0.009], P["steel"], sides=5)
|
|
K.tube(r, "antenna_r",
|
|
[(-0.20, 0.10, 1.84), (-0.44, 0.14, 2.24)],
|
|
[0.016, 0.009], P["steel"], sides=5)
|
|
for i, sx in enumerate((-1, 1)):
|
|
K.crystal(r, "knob_%d" % i, (sx * 0.46, -0.44, 0.78), 0.055,
|
|
P["steel"], sides=6, seed=20 + i,
|
|
tilt=(math.pi / 2, 0, 0))
|
|
K.plate(r, "vent", K.octagon(0.30, 0.10), 0.0, 0.012, 1.0,
|
|
P["redaction"], shift=(0, 0, 1.845))
|
|
return r
|
|
|
|
|
|
# ------------------------------------------------------------------ pedestal
|
|
def build_pedestal():
|
|
r = K.new_actor("Pedestal")
|
|
K.loft(r, "plinth", [
|
|
{"z": 0.0, "r": (0.62, 0.62), "n": 14},
|
|
{"z": 0.10, "r": (0.66, 0.66), "n": 14},
|
|
{"z": 0.48, "r": (0.58, 0.58), "n": 14, "fold": (0.015, 5)},
|
|
{"z": 0.92, "r": (0.54, 0.54), "n": 14, "fold": (0.02, 5)},
|
|
{"z": 1.02, "r": (0.60, 0.60), "n": 14},
|
|
], P["concrete"], ao=0.14)
|
|
K.plate(r, "top", K.octagon(0.52, 0.52), 1.02, 1.08, 1.0, P["redaction"])
|
|
K.tube(r, "weapon_body",
|
|
[(0.0, -0.10, 1.26), (0.0, -0.36, 1.30), (0.0, -0.62, 1.34)],
|
|
[0.09, 0.075, 0.06], P["plastic"], sides=8)
|
|
grip = K.plate(r, "grip", K.octagon(0.07, 0.11), 0.0, 0.20, 0.88,
|
|
P["steel_dk"])
|
|
place(grip, rot=(math.pi / 2, 0, 0), offset=(0, -0.06, 1.06))
|
|
K.crystal(r, "muzzle", (0, -0.64, 1.34), 0.10, P["steel"], sides=6,
|
|
seed=5, tilt=(math.pi / 2, 0, 0))
|
|
K.crystal(r, "inlay", (0, -0.34, 1.40), 0.07, P["paper"], sides=5,
|
|
seed=6)
|
|
K.ring(r, "base_glow", (0, 0, 0.12), 0.60, 0.022, P["paper"],
|
|
segments=16)
|
|
return r
|
|
|
|
|
|
# ---------------------------------------------------------------------- duck
|
|
def build_duck():
|
|
r = K.new_actor("Duck")
|
|
K.loft(r, "plinth", [
|
|
{"z": 0.0, "r": (0.42, 0.42), "n": 10},
|
|
{"z": 0.08, "r": (0.46, 0.46), "n": 10},
|
|
{"z": 0.76, "r": (0.40, 0.40), "n": 10},
|
|
{"z": 0.82, "r": (0.44, 0.44), "n": 10},
|
|
], P["concrete"], ao=0.14)
|
|
K.blob(r, "body", (0, 0, 1.00), (0.26, 0.22, 0.19), P["duck"],
|
|
subdiv=3, seed=2, ao=0.04)
|
|
K.blob(r, "head", (0, -0.14, 1.22), (0.15, 0.15, 0.15), P["duck"],
|
|
subdiv=3, seed=3, ao=0.04)
|
|
K.crystal(r, "beak", (0, -0.29, 1.19), 0.12, P["hiss"], sides=6,
|
|
seed=4, tilt=(math.pi / 2, 0, 0))
|
|
for side in (-1, 1):
|
|
K.blob(r, "eye_%d" % side, (side * 0.075, -0.25, 1.26),
|
|
(0.018, 0.018, 0.018), P["redaction"], subdiv=1,
|
|
seed=10 + side)
|
|
K.tube(r, "tail", [(0, 0.20, 1.04), (0, 0.32, 1.14)],
|
|
[0.08, 0.025], P["duck"], sides=6)
|
|
# Glass case as a slim brass frame (alpha isn't part of the vertex palette).
|
|
for sx in (-1, 1):
|
|
for sy in (-1, 1):
|
|
K.tube(r, "frame_%d_%d" % (sx, sy),
|
|
[(sx * 0.33, sy * 0.33, 0.84),
|
|
(sx * 0.33, sy * 0.33, 1.48)], [0.014, 0.014],
|
|
P["brass"], sides=5)
|
|
K.tube(r, "frame_top",
|
|
[(-0.33, -0.33, 1.48), (0.33, -0.33, 1.48),
|
|
(0.33, 0.33, 1.48), (-0.33, 0.33, 1.48), (-0.33, -0.33, 1.48)],
|
|
[0.014] * 5, P["brass"], sides=5)
|
|
return r
|
|
|
|
|
|
# ------------------------------------------------------------------- cabinet
|
|
def build_cabinet():
|
|
r = K.new_actor("Cabinet")
|
|
K.loft(r, "body", [
|
|
{"z": 0.0, "r": (0.48, 0.36), "n": 14},
|
|
{"z": 0.84, "r": (0.48, 0.36), "n": 14},
|
|
{"z": 1.68, "r": (0.48, 0.36), "n": 14},
|
|
{"z": 1.76, "r": (0.52, 0.40), "n": 14},
|
|
], P["redaction"], ao=0.10)
|
|
for i in range(4):
|
|
z = 0.28 + i * 0.40
|
|
K.plate(r, "drawer_%d" % i, K.octagon(0.40, 0.30), 0.0, 0.018,
|
|
1.0, P["plastic"], shift=(0, 0, z))
|
|
K.tube(r, "handle_%d" % i,
|
|
[(-0.18, -0.375, z + 0.10), (0.18, -0.375, z + 0.10)],
|
|
[0.022, 0.022], P["steel"], sides=6)
|
|
K.plate(r, "label_%d" % i, K.octagon(0.11, 0.025), 0.0, 0.006,
|
|
1.0, P["paper"], shift=(0, 0, z + 0.02))
|
|
for side in (-1, 1):
|
|
K.tube(r, "edge_%d" % side,
|
|
[(side * 0.46, -0.34, 0.04), (side * 0.46, -0.34, 1.72)],
|
|
[0.018, 0.018], P["steel_dk"], sides=5)
|
|
return r
|
|
|
|
|
|
# --------------------------------------------------------------------- crate
|
|
def build_crate():
|
|
r = K.new_actor("Crate")
|
|
K.loft(r, "body", [
|
|
{"z": 0.0, "r": (0.52, 0.42), "n": 14, "fold": (0.02, 5)},
|
|
{"z": 0.36, "r": (0.53, 0.43), "n": 14, "fold": (0.025, 5)},
|
|
{"z": 0.72, "r": (0.54, 0.44), "n": 14, "fold": (0.025, 5)},
|
|
{"z": 0.78, "r": (0.56, 0.46), "n": 14},
|
|
], P["tan"], ao=0.14)
|
|
K.plate(r, "lid", K.octagon(0.56, 0.46), 0.78, 0.86, 0.98,
|
|
P["navy_dk"])
|
|
for sx in (-1, 1):
|
|
for sy in (-1, 1):
|
|
K.tube(r, "brace_%d_%d" % (sx, sy),
|
|
[(sx * 0.46, sy * 0.36, 0.02),
|
|
(sx * 0.46, sy * 0.36, 0.76)], [0.03, 0.03],
|
|
P["steel_dk"], sides=5)
|
|
K.plate(r, "stencil", K.octagon(0.20, 0.10), 0.0, 0.008, 1.0,
|
|
P["redaction"], shift=(0, -0.46, 0.42))
|
|
K.ring(r, "seal", (0, 0, 0.87), 0.24, 0.018, P["hiss_dull"],
|
|
segments=10)
|
|
return r
|
|
|
|
|
|
# -------------------------------------------------------------------- debris
|
|
def build_debris():
|
|
# A shattered floor tile, not a smooth boulder. CONCRETE CALL uses this as
|
|
# its flying heap and PUSH sheds the same rubble outward in a shockwave, so
|
|
# the broken-slab silhouette has to read at tactical distance. Feet at 0.
|
|
r = K.new_actor("Debris")
|
|
|
|
def jagged(rx, ry, seed):
|
|
rng = random.Random(seed)
|
|
pts = []
|
|
for i in range(9):
|
|
a = 2.0 * math.pi * i / 9
|
|
k = rng.uniform(0.78, 1.12)
|
|
pts.append((math.cos(a) * rx * k, math.sin(a) * ry * k))
|
|
return pts
|
|
|
|
# Two broken tiles, one tilted, give the mass a legible broken-slab edge
|
|
# instead of the old single smooth blob.
|
|
main = K.plate(r, "slab_main", jagged(0.84, 0.60, 41), 0.30, 0.54, 0.93,
|
|
P["concrete_lt"], ao=0.14)
|
|
place(main, rot=(0.04, -0.06, 0.12))
|
|
tilt = K.plate(r, "slab_tilt", jagged(0.50, 0.38, 42), 0.36, 0.64, 0.76,
|
|
P["concrete_mid"], shift=(0.16, -0.10), ao=0.12)
|
|
place(tilt, rot=(0.42, -0.26, -0.34))
|
|
chip = K.plate(r, "slab_chip", jagged(0.32, 0.26, 43), 0.40, 0.62, 0.74,
|
|
P["concrete_warm"], shift=(-0.30, 0.18), ao=0.10)
|
|
place(chip, rot=(-0.38, 0.22, 0.55))
|
|
K.blob(r, "fracture", (0.0, 0.0, 0.26), (0.70, 0.52, 0.24),
|
|
P["concrete"], subdiv=1, warp=0.28, seed=9, smooth=False, ao=0.10)
|
|
|
|
chunks = [
|
|
((-0.56, 0.10, 0.20), (0.38, 0.30, 0.20), 11, "concrete_lt"),
|
|
((0.52, 0.20, 0.24), (0.34, 0.28, 0.22), 12, "concrete_mid"),
|
|
((0.16, -0.50, 0.18), (0.34, 0.26, 0.18), 13, "concrete_warm"),
|
|
((-0.34, -0.40, 0.24), (0.28, 0.24, 0.26), 14, "concrete"),
|
|
((0.50, -0.34, 0.32), (0.26, 0.24, 0.30), 15, "concrete_lt"),
|
|
((0.00, 0.54, 0.22), (0.32, 0.24, 0.22), 16, "concrete_mid"),
|
|
]
|
|
for i, (center, scale, seed, tone) in enumerate(chunks):
|
|
K.blob(r, "chunk_%d" % i, center, scale, P[tone],
|
|
subdiv=2 if i % 2 == 0 else 1, warp=0.32, seed=seed,
|
|
smooth=False, ao=0.10)
|
|
|
|
# Concrete splinters stand proud of the mass: sharp facets catch the key
|
|
# light and break up the top silhouette from every camera angle.
|
|
for i, (x, y, z, size, tilt_v) in enumerate([
|
|
(-0.52, -0.18, 0.52, 0.30, (0.3, -0.2, 0.5)),
|
|
(0.38, 0.30, 0.58, 0.26, (-0.4, 0.3, -0.3)),
|
|
(0.18, -0.42, 0.50, 0.24, (0.2, 0.4, 0.6)),
|
|
(-0.12, 0.40, 0.54, 0.22, (-0.3, 0.2, 0.4)),
|
|
]):
|
|
K.crystal(r, "splinter_%d" % i, (x, y, z), size,
|
|
P["concrete_warm"] if i % 2 else P["concrete_lt"],
|
|
sides=4, seed=50 + i, tilt=tilt_v, ao=0.08)
|
|
|
|
# Bent rebar pokes out of the broken faces — the detail that sells rubble.
|
|
for i, pts in enumerate([
|
|
[(-0.42, 0.18, 0.46), (-0.58, 0.34, 0.72), (-0.52, 0.50, 0.80)],
|
|
[(0.46, -0.12, 0.40), (0.66, -0.24, 0.62), (0.72, -0.18, 0.74)],
|
|
[(0.10, 0.46, 0.44), (0.16, 0.64, 0.66)],
|
|
]):
|
|
K.tube(r, "rebar_%d" % i, pts, [0.022] * len(pts),
|
|
P["steel_dk"], sides=5)
|
|
|
|
# Hiss corruption stays the accent colour: growths plus glowing fractures.
|
|
for i, (x, y, z, tilt_v) in enumerate([
|
|
(-0.38, -0.14, 0.68, (0.3, -0.2, 0.4)),
|
|
(0.30, 0.22, 0.72, (-0.4, 0.3, -0.2)),
|
|
(0.46, -0.26, 0.62, (0.2, 0.4, 0.3)),
|
|
]):
|
|
K.crystal(r, "growth_%d" % i, (x, y, z), 0.24, P["hiss"],
|
|
sides=5, seed=30 + i, tilt=tilt_v)
|
|
for i in range(3):
|
|
K.tube(r, "crack_%d" % i,
|
|
[(-0.5 + i * 0.45, -0.4, 0.58),
|
|
(-0.3 + i * 0.45, -0.1, 0.68),
|
|
(-0.1 + i * 0.45, 0.2, 0.62)],
|
|
[0.018, 0.02, 0.014], P["hiss_hot"], sides=5)
|
|
|
|
# A few pieces dip under the origin; lift the heap so its feet sit exactly
|
|
# on the floor after export.
|
|
for part in r.children:
|
|
for v in part.data.vertices:
|
|
v.co.z += 0.03
|
|
part.data.update()
|
|
return r
|
|
|
|
BUILDERS = [
|
|
("hotline", build_hotline, 1200),
|
|
("tv", build_tv, 1200),
|
|
("pedestal", build_pedestal, 1000),
|
|
("duck", build_duck, 1000),
|
|
("cabinet", build_cabinet, 1200),
|
|
("crate", build_crate, 1000),
|
|
("debris", build_debris, 3000),
|
|
]
|
|
|
|
exported = []
|
|
for name, builder, cap in BUILDERS:
|
|
root = builder()
|
|
K.merge_actor(root, name)
|
|
tris = K.triangle_count(root)
|
|
print("[budget] %-10s %5d tris (cap %d) %s"
|
|
% (name, tris, cap, "OK" if tris <= cap else "OVER"))
|
|
out = os.path.join(MODEL_DIR, name + ".glb")
|
|
K.export_actor(root, name, out)
|
|
exported.append((name, tris, os.path.getsize(out)))
|
|
|
|
SLOTS = {"Hotline": -7.5, "BenicoffTV": -4.5, "Pedestal": -1.5,
|
|
"Duck": 1.5, "Cabinet": 4.5, "Crate": 7.5, "Debris": 10.5}
|
|
for obj in bpy.data.objects:
|
|
if obj.name in SLOTS:
|
|
obj.location.x = SLOTS[obj.name]
|
|
|
|
world = bpy.data.worlds.new("PropWorld")
|
|
bpy.context.scene.world = world
|
|
world.use_nodes = True
|
|
bg = next(n for n in world.node_tree.nodes if n.type == "BACKGROUND")
|
|
bg.inputs["Color"].default_value = (*K.rgb("#0d0f12"), 1.0)
|
|
bg.inputs["Strength"].default_value = 0.9
|
|
|
|
import mathutils
|
|
for name, loc, power, col in (
|
|
("Key", (-2, -8, 9), 2200, "#eef2ff"),
|
|
("HissFill", (8, -1, 5), 1100, "#ff3b46"),
|
|
("Rim", (0, 7, 6), 900, "#4ec9b0"),
|
|
):
|
|
data = bpy.data.lights.new(name, "AREA")
|
|
data.energy = power
|
|
data.shape = "DISK"
|
|
data.size = 8
|
|
data.color = K.rgb(col)
|
|
obj = bpy.data.objects.new(name, data)
|
|
bpy.context.scene.collection.objects.link(obj)
|
|
obj.location = loc
|
|
obj.rotation_euler = (mathutils.Vector((0, 0, 1)) -
|
|
mathutils.Vector(loc)).to_track_quat("-Z", "Y").to_euler()
|
|
|
|
cam_data = bpy.data.cameras.new("PropCam")
|
|
cam = bpy.data.objects.new("PropCam", cam_data)
|
|
bpy.context.scene.collection.objects.link(cam)
|
|
cam.location = (1.0, -20.0, 9.0)
|
|
cam.rotation_euler = (mathutils.Vector((0, 0, 0.95)) -
|
|
cam.location).to_track_quat("-Z", "Y").to_euler()
|
|
cam_data.lens = 42
|
|
scene = bpy.context.scene
|
|
scene.camera = cam
|
|
engines = [i.identifier for i in bpy.types.RenderSettings.bl_rna.properties["engine"].enum_items]
|
|
scene.render.engine = "BLENDER_EEVEE_NEXT" if "BLENDER_EEVEE_NEXT" in engines else engines[0]
|
|
scene.render.resolution_x = 1200
|
|
scene.render.resolution_y = 520
|
|
scene.render.image_settings.file_format = "PNG"
|
|
scene.render.filepath = os.path.join(CONCEPT_DIR, "props_lineup.png")
|
|
bpy.ops.render.render(write_still=True)
|
|
|
|
bpy.ops.wm.save_as_mainfile(filepath=os.path.join(BLEND_DIR, "fbc_props.blend"))
|
|
print("[done] props:", ", ".join("%s(%d tris)" % (n, t)
|
|
for n, t, _ in exported))
|