defs.lua
来自「这是整套横扫千军3D版游戏的源码」· LUA 代码 · 共 68 行
LUA
68 行
-------------------------------------------------------------------------------------------------------------------------------------------------------------------- file: defs.lua-- brief: entry point for unitdefs, featuredefs, and weapondefs parsing-- author: Dave Rodgers-- notes: Spring.GetModOptions() is available---- Copyright (C) 2007.-- Licensed under the terms of the GNU GPL, v2 or later.------------------------------------------------------------------------------------------------------------------------------------------------------------------DEFS = {}----------------------------------------------------------------------------------------------------------------------------------------------------------------local function LoadDefs(name) local filename = 'gamedata/' .. name .. '.lua' local success, result = pcall(VFS.Include, filename) if (not success) then Spring.Echo('Failed to load ' .. name) error(result) end if (result == nil) then error('Missing lua table for ' .. name) end return resultend----------------------------------------------------------------------------------------------------------------------------------------------------------------Spring.TimeCheck('Loading all definitions: ', function() DEFS.unitDefs = LoadDefs('unitDefs') DEFS.featureDefs = LoadDefs('featureDefs') DEFS.weaponDefs = LoadDefs('weaponDefs') DEFS.armorDefs = LoadDefs('armorDefs') DEFS.moveDefs = LoadDefs('moveDefs')end)-------------------------------------------------------------------------------------------------------------------------------------------------------------------- NOTE: the keys have to be lower case--return { unitdefs = DEFS.unitDefs, featuredefs = DEFS.featureDefs, weapondefs = DEFS.weaponDefs, armordefs = DEFS.armorDefs, movedefs = DEFS.moveDefs,}----------------------------------------------------------------------------------------------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?