Skip to content

Commit

Permalink
disabled level verifier, cheats fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DX9T0 committed Aug 4, 2024
1 parent db31cf6 commit 7144f5f
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 79 deletions.
11 changes: 10 additions & 1 deletion MOD_CONTENT/CruS Mod Base/scripts/cheats.gd
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ var last_col_layer := 2
var scene_npcs := []
var hostile_queue := []

func _ready():
print("CHEATS LOADED")

func _process(delta):
if inf_mag:
var wep = Global.player.weapon
Expand All @@ -53,10 +56,16 @@ func _process(delta):
for i in remove:
hostile_queue.remove(i)

var PlayerClass = preload("res://Scripts/Player.gd")

func _input(ev):
if not(ev is InputEventKey and ev.is_pressed()):
return
if ev.scancode == KEY_ENTER and not cheated and is_instance_valid(Global.nav):
if ev.scancode == KEY_ENTER and not cheated:# and is_instance_valid(Global.nav):
if not is_instance_valid(Global.player):
return
if not (Global.player is PlayerClass):
return
if last_keys.find("CEOMINDSET") != -1:
enable_cheat_prompt()
elif !cheated:
Expand Down
159 changes: 81 additions & 78 deletions MOD_CONTENT/CruS Mod Base/scripts/level_verifier.gd
Original file line number Diff line number Diff line change
Expand Up @@ -36,82 +36,85 @@ func check_json(m: Dictionary) -> Array:
errors.append("Property 'reward' must be a number")
return errors

func check_scene(path, lvl = { }) -> Array:
# if path is String:
# var deps := ResourceLoader.get_dependencies(path)
# if len(deps) > 0:
# Mod.mod_log(' - Scene Dependencies:', "CMB:check_scene")
#func check_scene(path, lvl = { }) -> Array:
# # if path is String:
# # var deps := ResourceLoader.get_dependencies(path)
# # if len(deps) > 0:
# # Mod.mod_log(' - Scene Dependencies:', "CMB:check_scene")
#
# # for idx in deps.size():
# # Mod.mod_log(' -> %s' % [ deps[idx] ], "CMB:check_scene")
# dprint('Checking scene: %s' % [ path ], 'check_scene')
#
# var scn = load(path) if path is String else path
# var qmaps = []
# var nav = false
# var player = null
# var fish_warned = false
#
# var errors = []
#
# if !scn:
# return ["Broken scene file or missing dependencies"]
# elif path is String:
# scn = scn.instance()
# if scn.name != "Level":
# scn.name = "Level"
# dprint('WARNING: Root node isn\'t called "Level", setting it to that for now', "check_scene")
#
# for node in scn.get_children():
# if node is Navigation:
# nav = node
# if !node.get_script() or node.get_script().get_path() != "res://Scripts/Navigation.gd":
# node.set_script(preload("res://Scripts/Navigation.gd"))
# node.set_process(true)
# dprint("WARNING: Navigation node doesn't have a Navigation.gd attached, attaching one for now", "check_scene")
# if !node.get_node_or_null("NavigationMeshInstance"):
# errors.append("Navigation node has no NavigationMeshInstance child")
# else:
# var navmesh = node.get_node("NavigationMeshInstance").navmesh
# if !navmesh or navmesh.get_polygon_count() == 0:
# dprint("WARNING: Navmesh is empty, NPCs won't move properly (it has to be baked in Godot)", "check_scene")
# if node is QodotMap:
# if !nav:
# errors.append("Navigation node is after QodotMap in the scene tree, it should be before QodotMap and any entities")
# if node.base_texture_dir != "res://Maps/textures":
# dprint("WARNING: QodotMap node \"" + node.get_name() + "\" base texture dir is not res://Maps/textures, setting it to that for now", "check_scene")
# node.base_texture_dir = "res://Maps/textures"
# qmaps.push_back(node)
# if node.get_filename() == "res://Player_Test.tscn":
# if player:
# errors.append("Multiple Player_Test.tscn instances found, there should only be one")
# else:
# player = node
#
# if len(qmaps) == 0:
# errors.append("Missing QodotMap node. Make sure it was taken back out of NavigationMeshInstance after navmesh baking")
# else:
# for qm in qmaps:
# var child_count = (qm as QodotMap).get_children().size()
# if build_verbose_logging:
# dprint('Scanning %d children' % [ child_count ], 'check_scene')
# var node: Node
# for idx in child_count:
# node = (qm as QodotMap).get_child(idx)
# if build_verbose_logging:
# dprint(' [%04d/%04d] @%s' % [ idx + 1, child_count, node ], 'check_scene')
# if node.get_filename() == "res://Player_Test.tscn":
# if player:
# dprint('Multiple Player_Test.tscn instances found, there should only be one', 'check_scene')
# else:
# player = node
# elif (node.get_script() and node.get_script().get_path() == "res://Scripts/Water.gd" and
# !lvl.has("fish") and !fish_warned):
# dprint("WARNING: Level seems to contain fishable water but no fish property is defined, using default [\"FISH\", \"DEAD\"]", "check_scene")
# fish_warned = true
#
# if !nav:
# errors.append("Missing or bad Navigation node")
# if !player:
# errors.append("Missing or bad player node (there should be an instance of res://Player_Test.tscn)")
# return errors

# for idx in deps.size():
# Mod.mod_log(' -> %s' % [ deps[idx] ], "CMB:check_scene")
dprint('Checking scene: %s' % [ path ], 'check_scene')

var scn = load(path) if path is String else path
var qmaps = []
var nav = false
var player = null
var fish_warned = false

var errors = []

if !scn:
return ["Broken scene file or missing dependencies"]
elif path is String:
scn = scn.instance()
if scn.name != "Level":
scn.name = "Level"
dprint('WARNING: Root node isn\'t called "Level", setting it to that for now', "check_scene")

for node in scn.get_children():
if node is Navigation:
nav = node
if !node.get_script() or node.get_script().get_path() != "res://Scripts/Navigation.gd":
node.set_script(preload("res://Scripts/Navigation.gd"))
node.set_process(true)
dprint("WARNING: Navigation node doesn't have a Navigation.gd attached, attaching one for now", "check_scene")
if !node.get_node_or_null("NavigationMeshInstance"):
errors.append("Navigation node has no NavigationMeshInstance child")
else:
var navmesh = node.get_node("NavigationMeshInstance").navmesh
if !navmesh or navmesh.get_polygon_count() == 0:
dprint("WARNING: Navmesh is empty, NPCs won't move properly (it has to be baked in Godot)", "check_scene")
if node is QodotMap:
if !nav:
errors.append("Navigation node is after QodotMap in the scene tree, it should be before QodotMap and any entities")
if node.base_texture_dir != "res://Maps/textures":
dprint("WARNING: QodotMap node \"" + node.get_name() + "\" base texture dir is not res://Maps/textures, setting it to that for now", "check_scene")
node.base_texture_dir = "res://Maps/textures"
qmaps.push_back(node)
if node.get_filename() == "res://Player_Test.tscn":
if player:
errors.append("Multiple Player_Test.tscn instances found, there should only be one")
else:
player = node

if len(qmaps) == 0:
errors.append("Missing QodotMap node. Make sure it was taken back out of NavigationMeshInstance after navmesh baking")
else:
for qm in qmaps:
var child_count = (qm as QodotMap).get_children().size()
if build_verbose_logging:
dprint('Scanning %d children' % [ child_count ], 'check_scene')
var node: Node
for idx in child_count:
node = (qm as QodotMap).get_child(idx)
if build_verbose_logging:
dprint(' [%04d/%04d] @%s' % [ idx + 1, child_count, node ], 'check_scene')
if node.get_filename() == "res://Player_Test.tscn":
if player:
dprint('Multiple Player_Test.tscn instances found, there should only be one', 'check_scene')
else:
player = node
elif (node.get_script() and node.get_script().get_path() == "res://Scripts/Water.gd" and
!lvl.has("fish") and !fish_warned):
dprint("WARNING: Level seems to contain fishable water but no fish property is defined, using default [\"FISH\", \"DEAD\"]", "check_scene")
fish_warned = true

if !nav:
errors.append("Missing or bad Navigation node")
if !player:
errors.append("Missing or bad player node (there should be an instance of res://Player_Test.tscn)")
return errors
func check_scene(path: String, lvl := {}) -> Array:
return []

0 comments on commit 7144f5f

Please sign in to comment.