Inspections

Inspections for the mistakes the engine reports only at build time, or not at all. They are under Settings → Editor → Inspections → Enforce Script:

Inspection Reports
Redeclared method without ‘override’ a redeclared method missing override
‘override’ with no base declaration the reverse: an override that overrides nothing
Variable already declared in this method a name declared twice in one method — an error here even across disjoint if branches
‘modded class’ patching nothing a modded class that patches nothing
Override in a modded class does not call super an override in a modded class that never calls super with its own name, which drops vanilla’s and every other mod’s layer; see Modded overrides below
Variable named after a type a variable named after a type
Dispatch string naming no method an AddTimer / AddRPC string naming no method on its target
Localization key with no stringtable row a STR_… key with no stringtable row; see Stringtables
Name from a later script module see Script modules below
Malformed stringtable row see Stringtables
Base class not declared in this scope a config.cpp class whose base Addon Builder would not find; see Config files

The two override ones, the super one, the stringtable-key one (Create stringtable row) and the config base-class one (Add ‘class Apple;’) carry quick fixes. Each is gated so that a class whose parent the plugin never indexed produces no report at all, and the duplicate-local rule is measured against 120 vanilla files to prove it stays silent on code that compiles.

To check a whole project instead of the open file:

  • One inspection: Code → Analyze Code → Run Inspection by Name (Ctrl+Alt+Shift+I). Type its name, such as ‘override’ with no base declaration, and choose the project as the scope.
  • All of them: Code → Inspect Code.

The results open in the Problems tool window, grouped by file, with their quick fixes.

Not supported yet: a superclass named through a typedef, as in vanilla’s typedef House BuildingSuper;. Members inherited through it are not found, so an override of one can be reported as having no base declaration.

Script modules

Script modules — DayZ compiles scripts in five modules, 1_Core to 5_Mission, and each one sees only itself and the modules before it. Name from a later script module reports a type, function, field or method used from a module that cannot see it, such as PlayerBase (4_World) named from 3_Game, which the game otherwise reports only at launch as Can’t compile “Game” script module.

A file’s module comes from CfgMods → defs → gameScriptModule (and the other four) → files[] in the addon’s config.cpp, and otherwise from the standard folder names (3_Game, scripts/4_world, …).

One visible declaration is enough: a class declared in 3_Game and modded in 4_World can be named from 3_Game, but the members only the 4_World layer adds cannot. A modded class is reported too when only a later module declares its class (modded class PlayerBase in 3_Game); such a layer does not compile, so it does not make the class visible from its own module either.

proto declarations are not checked, since the engine’s own classes are known to every module (vanilla 1_core/proto/proto.c returns Object, a 3_Game class). Measured silent on the 2,838 vanilla files of 1_Core to 4_World and on 632 files of three large mods.

Not supported: a file in no known module (outside the five folders and not listed in any files[]) is not checked, and completion still offers everything, visible or not.

Modded overrides

In a modded class, super.Method() calls the previous layer: other mods’ layers and, at the end, vanilla. Override in a modded class does not call super reports an override whose body never calls it, which compiles and works alone but breaks next to other mods: SetActions without super.SetActions() removes every other action from the item, and OnStoreLoad without it desynchronises the persistence stream. One call anywhere in the body is enough, in any branch.

  • Reported by default: void methods, and OnStoreSave, OnStoreLoad, SetActions, EEInit, EEDelete, OnRPC, OnVariablesSynchronized and OnInit whatever they return. An option reports every value-returning override too; it is off, since return false; is usually meant.
  • A weak warning. Add super call inserts super.Method(args); as the first statement, or, in a bool method, if (!super.OnStoreLoad(ctx, version)) return false;. Suppress it on a method that replaces vanilla’s behaviour on purpose.
  • An ordinary subclass is never reported, and nor is an override whose base the plugin cannot see.

Checking with the engine

The engine itself can compile the project’s scripts too, which catches what no inspection can: see Checking scripts.