Files

21 lines
766 B
GDScript
Raw Permalink Normal View History

2026-09-12 11:01:37 +02:00
class_name StylooWeapons
extends RefCounted
const MODELS := {2:"shotgun",3:"awp",9:"shotgun"}
static func build(index: int) -> Node3D:
var model := (load("res://scenes/weapons/styloo_%s.tscn" % MODELS[index]) as PackedScene).instantiate() as Node3D
model.name = "WeaponModel"
model.set_meta("weapon_index",index)
model.set_meta("styloo_model",MODELS[index])
# The imported scope can be replaced by the existing reflex attachment.
if index == 3:
var optic := Node3D.new()
optic.name = "FactoryOptic"
model.get_node("Frame").add_child(optic)
for child in model.get_node("Frame/receiver").get_children():
if "scope" in str(child.name) or "tendon" in str(child.name):
SovietWeapons.clear_owner(child)
child.reparent(optic,false)
return model