User:Master-athmos: Difference between revisions

From Spring
Jump to navigationJump to search
No edit summary
No edit summary
Line 494: Line 494:
|name = CallAsTeam
|name = CallAsTeam
|arg1 = {{type|number}} teamID
|arg1 = {{type|number}} teamID
|arg2 = lua_function f
|arg3 = arg1
|arg4 = arg2
|arg5 = ...
|arg6 =
|arg7 =
|arg8 =
|arg9 =
|return = {{type|nil}}
|info =
}}
or <br>
{{LuaCallout
|prefix =
|name = CallAsTeam
|arg1 = {{type|table}} access
|arg2 = lua_function f
|arg2 = lua_function f
|arg3 = arg1
|arg3 = arg1
Line 505: Line 521:
|info = LOS checking depends on the `selected` team, this functions allows to select another one.
|info = LOS checking depends on the `selected` team, this functions allows to select another one.
}}
}}
   <span class=note>access = {
   <span class=note>access = {
     [ctrl = number teamID,]
     [ctrl = number teamID,]
Line 535: Line 550:
|name = CallAsTeam
|name = CallAsTeam
|arg1 = {{type|number}} teamID
|arg1 = {{type|number}} teamID
|arg2 = lua_function f
|arg3 = arg1
|arg4 = arg2
|arg5 = ...
|arg6 =
|arg7 =
|arg8 =
|arg9 =
|return = {{type|nil}}
|info =
}}
or <br>
{{LuaCallout
|prefix =
|name = CallAsTeam
|arg1 = {{type|table}} access
|arg2 = lua_function f
|arg2 = lua_function f
|arg3 = arg1
|arg3 = arg1
Line 559: Line 590:
|prefix = Script.
|prefix = Script.
|name = PermitHelperAIs
|name = PermitHelperAIs
|arg1 = [[type|boolean}} permit
|arg1 = {{type|boolean}} permit
|arg2 =  
|arg2 =  
|arg3 =  
|arg3 =  

Revision as of 01:17, 3 February 2021

Development < Lua Scripting < User:Master-athmos

All Lua Contexts

Script.Kill ( )
return: nil

No description available


Script.GetName ( )
return: string luaInstanceName

Returns the luaInstanceName (e.g. "LuaUI", "LuaRules", "LuaGaia", ...).


Script.GetSynced ( )
return: bool is_synced

No description available


Script.GetFullRead ( )
return: bool has_fullctrl

No description available


Script.GetFullRead ( )
return: bool has_fullread

No description available


Script.GetCtrlTeam ( )
return: number ctrl_teamID

No description available


Script.GetReadTeam ( )
return: number read_teamID

No description available


Script.GetReadAllyTeam ( )
return: number read_allyTeamID

No description available


Script.GetSelectTeam ( )
return: number select_teamID

Defines which teamunits can be selected via Spring.SelectUnitMap/Spring.SelectUnitArray.


Script.GetGlobal ( )
return: nil | table globalEnv

Returns nil if not in dev-mode.


Script.GetRegistry ( )
return: nil | table registryEnv

Returns nil if not in dev-mode.


Script.GetCallInList ( )
return: table known_callins

Known CallIns are:
 known_callins = {
   ["CallInName"] = { unsynced = boolean, controller = boolean }, (`controller` is true for
all CallIns which's return values are used by the engine for synced code,
e.g. "AllowUnitCreation" is a controller) ... }


Script.IsEngineMinVersion ( major [, minor [, commits ]] )
return: nil | boolean isMinVersion

No description available

Special team constants

Script.NO_ACCESS_TEAM ( )
return: number ???

No description available


Script.ALL_ACCESS_TEAM ( )
return: number ???

No description available

LuaUI only

Spring.SetShockFrontFactors ( number minArea, number minPower, number distAdj )
return: nil

No description available


Spring.UpdateCallIn ( string callin_name )
return: nil

No description available

LuaGadgets only

Synced

number COBSCALE

No description available


Script.AddActionFallback ( string command, string help )
return: nil | boolean ???

No description available


Script.RemoveActionFallback ( string command )
return: nil | boolean ???

No description available


Script.UpdateCallIn ( string callin_name )
return: nil

No description available


Script.SetWatchFeature ( number featureDefID, boolean enable )
return: nil

Enables the `UnitFeatureCollision` callin for a specific FeatureDef.


Script.GetWatchFeature ( number featureDefID )
return: nil | boolean enabled

No description available


Script.SetWatchUnit ( number unitDefID, boolean enable )
return: nil

Enables the `UnitUnitCollision`, `UnitFeatureCollision` and `UnitMoveFailed` callins for a specific UnitDef.


Script.GetWatchUnit ( number unitDefID )
return: nil | boolean enabled

No description available


Script.SetWatchWeapon ( number weaponDefID, boolean enable )
return: nil

Enables the `Explosion` and (as of 0.83+) `ProjectileCreated` and `ProjectileDestroyed` callins for a specific WeaponDef.


Script.GetWatchWeapon ( number weaponDefID )
return: nil | boolean enabled

No description available


Script.GetWatchWeapon ( number weaponDefID )
return: nil | boolean enabled

No description available


SendToUnsynced ( arg1, arg2, ... )
return: nil

Just nil, number, string and boolean datatypes are allowed as arguments! NO tables, userdatas, ...


CallAsTeam ( number teamID, lua_function f, arg1, arg2, ... )
return: nil

or
CallAsTeam ( table access, lua_function f, arg1, arg2, ... )
return: nil

LOS checking depends on the `selected` team, this functions allows to select another one.
 access = {
   [ctrl = number teamID,]
   [read = number teamID,]
   [select = number teamID,]
 }

Unsynced

Script.UpdateCallIn ( string callin_name )
return: nil

No description available


CallAsTeam ( number teamID, lua_function f, arg1, arg2, ... )
return: nil

or
CallAsTeam ( table access, lua_function f, arg1, arg2, ... )
return: nil

LOS checking depends on the `selected` team, this functions allows to select another one.
 access = {
   [ctrl = number teamID,]    (limits Spring.GiveOrderXYZ)
   [read = number teamID,]    (limits reading of unit params, e.g. Spring.GetUnitLosState)
   [select = number teamID,]    (limits Spring.SelectUnitXYZ)
 }

LuaRules only

Synced

Script.PermitHelperAIs ( boolean permit )
return: nil

No description available