mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-18 19:44:58 +01:00
All code files must now be included in the .dme, removes some old duplicate files that never were (#14485)
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
/proc/log_tool(text, mob/initiator)
|
||||
if(CONFIG_GET(flag/log_tools))
|
||||
WRITE_LOG(GLOB.world_tool_log, "TOOL: [text]")
|
||||
@@ -1,15 +0,0 @@
|
||||
/datum/ai_planning_subtree/cursed/SelectBehaviors(datum/ai_controller/controller, delta_time)
|
||||
var/obj/item/item_pawn = controller.pawn
|
||||
|
||||
//make sure we have a target
|
||||
var/datum/weakref/target_ref = controller.blackboard[BB_ITEM_TARGET]
|
||||
var/mob/living/carbon/curse_target = target_ref?.resolve()
|
||||
|
||||
if(curse_target && get_dist(curse_target, item_pawn) > ITEM_AGGRO_VIEW_RANGE)
|
||||
controller.blackboard[BB_ITEM_TARGET] = null
|
||||
return
|
||||
|
||||
if(!curse_target)
|
||||
controller.queue_behavior(/datum/ai_behavior/find_and_set/item_target, BB_ITEM_TARGET, /mob/living/carbon, ITEM_AGGRO_VIEW_RANGE)
|
||||
|
||||
controller.queue_behavior(/datum/ai_behavior/item_move_close_and_attack/ghostly, BB_ITEM_TARGET, BB_ITEM_THROW_ATTEMPT_COUNT)
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
///This behavior is for obj/items, it is used to free themselves out of the hands of whoever is holding them
|
||||
/datum/ai_behavior/item_escape_grasp
|
||||
|
||||
/datum/ai_behavior/item_escape_grasp/perform(delta_time, datum/ai_controller/controller)
|
||||
. = ..()
|
||||
var/obj/item/item_pawn = controller.pawn
|
||||
var/mob/item_holder = item_pawn.loc
|
||||
if(!istype(item_holder))
|
||||
finish_action(controller, FALSE) //We're no longer beind held. abort abort!!
|
||||
item_pawn.visible_message(span_warning("[item_pawn] slips out of the hands of [item_holder]!"))
|
||||
item_holder.dropItemToGround(item_pawn, TRUE)
|
||||
finish_action(controller, TRUE)
|
||||
@@ -2835,6 +2835,7 @@
|
||||
#include "code\modules\events\anomaly_bluespace.dm"
|
||||
#include "code\modules\events\anomaly_flux.dm"
|
||||
#include "code\modules\events\anomaly_grav.dm"
|
||||
#include "code\modules\events\anomaly_hallucination.dm"
|
||||
#include "code\modules\events\anomaly_pyro.dm"
|
||||
#include "code\modules\events\anomaly_vortex.dm"
|
||||
#include "code\modules\events\aurora_caelus.dm"
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
import fnmatch
|
||||
import functools
|
||||
import glob
|
||||
import sys
|
||||
|
||||
reading = False
|
||||
|
||||
FORBID_INCLUDE = [
|
||||
# Included by _unit_test.dm
|
||||
r'code/modules/unit_tests/[!_]*.dm',
|
||||
|
||||
# Included by tgs/includes.dm
|
||||
r'code/modules/tgs/**/*.dm',
|
||||
]
|
||||
|
||||
lines = []
|
||||
|
||||
for line in sys.stdin:
|
||||
line = line.strip()
|
||||
|
||||
if line == "// BEGIN_INCLUDE":
|
||||
reading = True
|
||||
continue
|
||||
elif line == "// END_INCLUDE":
|
||||
break
|
||||
elif not reading:
|
||||
continue
|
||||
|
||||
lines.append(line)
|
||||
|
||||
fail_no_include = False
|
||||
|
||||
for code_file in glob.glob("code/**/*.dm", recursive=True):
|
||||
dm_path = code_file.replace('/', '\\')
|
||||
|
||||
included = f"#include \"{dm_path}\"" in lines
|
||||
forbid_include = False
|
||||
|
||||
for forbid in FORBID_INCLUDE:
|
||||
if not fnmatch.fnmatch(code_file, forbid):
|
||||
continue
|
||||
|
||||
forbid_include = True
|
||||
|
||||
if included:
|
||||
print(f"{dm_path} should not be included")
|
||||
print(f"::error file={code_file},line=1,title=DME Validator::File should not be included")
|
||||
fail_no_include = True
|
||||
|
||||
if forbid_include:
|
||||
continue
|
||||
|
||||
if not included:
|
||||
print(f"{dm_path} is not included")
|
||||
print(f"::error file={code_file},line=1,title=DME Validator::File is not included")
|
||||
fail_no_include = True
|
||||
|
||||
if fail_no_include:
|
||||
sys.exit(1)
|
||||
|
||||
def compare_lines(a, b):
|
||||
# Remove initial include as well as the final quotation mark
|
||||
a = a[len("#include \""):-1].lower()
|
||||
b = b[len("#include \""):-1].lower()
|
||||
|
||||
a_segments = a.split('\\')
|
||||
b_segments = b.split('\\')
|
||||
|
||||
for (a_segment, b_segment) in zip(a_segments, b_segments):
|
||||
a_is_file = a_segment.endswith(".dm")
|
||||
b_is_file = b_segment.endswith(".dm")
|
||||
|
||||
# code\something.dm will ALWAYS come before code\directory\something.dm
|
||||
if a_is_file and not b_is_file:
|
||||
return -1
|
||||
|
||||
if b_is_file and not a_is_file:
|
||||
return 1
|
||||
|
||||
# interface\something.dm will ALWAYS come after code\something.dm
|
||||
if a_segment != b_segment:
|
||||
return (a_segment > b_segment) - (a_segment < b_segment)
|
||||
|
||||
raise f"Two lines were exactly the same ({a} vs. {b})"
|
||||
|
||||
sorted_lines = sorted(lines, key = functools.cmp_to_key(compare_lines))
|
||||
|
||||
for (index, line) in enumerate(lines):
|
||||
if sorted_lines[index] != line:
|
||||
print(f"The include at line {index + 1} is out of order ({line})")
|
||||
print(f"::error file=tgstation.dme,line={index+1},title=DME Validator::The include at line {index + 1} is out of order ({line})")
|
||||
sys.exit(1)
|
||||
Reference in New Issue
Block a user