Fresh start: replace with naxIO/netfox-cs-sample foundation
Complete replacement of the tactical-shooter project with the netfox-cs-sample (MIT) — a CS 1.6 inspired multiplayer FPS built with Godot 4 and netfox. ## What's new - Full CS-style gameplay: teams (T/CT), rounds, economy, buy menu - 6 weapons: Knife, Glock, USP, AK-47, M4A1, AWP - Bomb plant/defuse with 2 bombsites - Flashbang & smoke grenades - Proper netfox rollback netcode at 64 tick - Network popup UI for host/join - HUD, crosshair, round timer, scoreboard - All netfox singletons registered as autoloads (works in exported builds) ## Architecture - Listen-server (host from client, no dedicated server binary) - Multiplayer-fps game lives at examples/multiplayer-fps/ - Netfox addons registered as autoloads for exported build compat - Godot 4.7 with Forward+ renderer ## Removed - Old headless-server architecture (client_main, server_main, player.gd, etc.) - Custom netfox bootstrap with ENet fallback - Old ChaffGames FPS template (2,420 lines, 844 KB) - SimulationServer GDExtension stub - Godot-jolt physics (netfox sample uses default Godot physics) - Duplicate weapon_data.gd, anti_cheat.gd, round_manager.gd, etc. - Server browser API Python venv (87 MB) - test_range map and modular assets ## Preserved - Git history - Server config at config/default_server_config.cfg - Windows export preset - Build directory (gitignored) Co-authored-by: naxIO <naxIO@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
extends Node3D
|
||||
class_name BulletHole
|
||||
|
||||
## Spawns a bullethole
|
||||
|
||||
## A StandardMaterial3D to use as the bullethole decal.
|
||||
@export var material: StandardMaterial3D
|
||||
## Maximum number of bullet holes
|
||||
@export var instance_limit: int = 20
|
||||
## The minimum size of the hole
|
||||
@export var hole_minimum_size: float = 0.15
|
||||
## The maximum size of the hole
|
||||
@export var hole_maximum_size: float = 0.2
|
||||
|
||||
@export_flags_3d_render var decal_mask := 1
|
||||
@export_flags_3d_render var decal_layer := 1
|
||||
|
||||
var pool := NodePool.new()
|
||||
|
||||
func _ready():
|
||||
pool.pool_limit = instance_limit
|
||||
pool.spawn_root = get_tree().root.get_node("multiplayer-fps/Map/StaticBody3D")
|
||||
|
||||
var decal_node: Decal = Decal.new()
|
||||
decal_node.cull_mask = decal_mask
|
||||
decal_node.layers = decal_layer
|
||||
|
||||
pool.target_node = decal_node
|
||||
|
||||
## Creates a bullethole decal, applies the texture and rotation/position calculations and removes the bullethole after the pool is full
|
||||
func action(result: Dictionary) -> void:
|
||||
var decal_node: Decal = pool.next()
|
||||
create_bullethole.call_deferred(decal_node, result)
|
||||
|
||||
func create_bullethole(decal_node: Decal, result: Dictionary):
|
||||
decal_node.texture_albedo = material.albedo_texture
|
||||
decal_node.texture_emission = material.emission_texture
|
||||
decal_node.texture_normal = material.normal_texture
|
||||
decal_node.size = Vector3(
|
||||
randf_range(hole_minimum_size, hole_maximum_size),
|
||||
0.02,
|
||||
randf_range(hole_minimum_size, hole_maximum_size)
|
||||
)
|
||||
|
||||
# Extract position and normal from the result dictionary
|
||||
var collision_point: Vector3 = result.position
|
||||
var collision_normal: Vector3 = result.normal.normalized()
|
||||
|
||||
# Construct a basis where the z-axis aligns with the collision normal
|
||||
var z_axis = collision_normal
|
||||
var x_axis = z_axis.cross(Vector3.UP).normalized()
|
||||
if x_axis.length() == 0:
|
||||
x_axis = z_axis.cross(Vector3.RIGHT).normalized()
|
||||
var y_axis = z_axis.cross(x_axis).normalized()
|
||||
var collision_basis = Basis(x_axis, y_axis, z_axis)
|
||||
|
||||
# Rotate the decal 90 degrees around the x-axis
|
||||
var rotation_basis = Basis().rotated(Vector3(1, 0, 0), deg_to_rad(90))
|
||||
var transform = Transform3D(rotation_basis, Vector3())
|
||||
|
||||
# Combine the collision basis and the rotation
|
||||
decal_node.global_transform = Transform3D(collision_basis, collision_point) * transform
|
||||
|
||||
# Apply random rotation around the normal
|
||||
var random_rotation = Basis(collision_normal, randf_range(0, 2 * PI))
|
||||
decal_node.global_transform.basis = random_rotation * decal_node.global_transform.basis
|
||||
Reference in New Issue
Block a user