_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include "stratagus.h"
#include "unittype.h"
#include "actions.h"
#include "animation.h"
#include "construct.h"
#include "editor.h"
#include "font.h"
#include "luacallback.h"
#include "map.h"
#include "player.h"
#include "script.h"
#include "sound.h"
#include "spells.h"
#include "ui.h"
#include "unit.h"
#include "unitsound.h"
#include "unit_manager.h"
#include "video.h"
script_unittype.cpp - The unit-type ccl functions. | |
CUnitTypeVar | UnitTypeVar |
static const char | COWARD_KEY [] = "Coward" |
Variables for UnitType and unit. More... | |
static const char | BUILDING_KEY [] = "Building" |
static const char | FLIP_KEY [] = "Flip" |
static const char | REVEALER_KEY [] = "Revealer" |
static const char | LANDUNIT_KEY [] = "LandUnit" |
static const char | AIRUNIT_KEY [] = "AirUnit" |
static const char | SEAUNIT_KEY [] = "SeaUnit" |
static const char | EXPLODEWHENKILLED_KEY [] = "ExplodeWhenKilled" |
static const char | VISIBLEUNDERFOG_KEY [] = "VisibleUnderFog" |
static const char | PERMANENTCLOAK_KEY [] = "PermanentCloak" |
static const char | DETECTCLOAK_KEY [] = "DetectCloak" |
static const char | ATTACKFROMTRANSPORTER_KEY [] = "AttackFromTransporter" |
static const char | VANISHES_KEY [] = "Vanishes" |
static const char | GROUNDATTACK_KEY [] = "GroundAttack" |
static const char | SHOREBUILDING_KEY [] = "ShoreBuilding" |
static const char | CANATTACK_KEY [] = "CanAttack" |
static const char | BUILDEROUTSIDE_KEY [] = "BuilderOutside" |
static const char | BUILDERLOST_KEY [] = "BuilderLost" |
static const char | CANHARVEST_KEY [] = "CanHarvest" |
static const char | HARVESTER_KEY [] = "Harvester" |
static const char | SELECTABLEBYRECTANGLE_KEY [] = "SelectableByRectangle" |
static const char | ISNOTSELECTABLE_KEY [] = "IsNotSelectable" |
static const char | DECORATION_KEY [] = "Decoration" |
static const char | INDESTRUCTIBLE_KEY [] = "Indestructible" |
static const char | TELEPORTER_KEY [] = "Teleporter" |
static const char | SHIELDPIERCE_KEY [] = "ShieldPiercing" |
static const char | SAVECARGO_KEY [] = "SaveCargo" |
static const char | NONSOLID_KEY [] = "NonSolid" |
static const char | WALL_KEY [] = "Wall" |
static const char | NORANDOMPLACING_KEY [] = "NoRandomPlacing" |
static const char | ORGANIC_KEY [] = "organic" |
static const char | SIDEATTACK_KEY [] = "SideAttack" |
static const char | SKIRMISHER_KEY [] = "Skirmisher" |
static const char | ALWAYSTHREAT_KEY [] = "AlwaysThreat" |
static const char | ELEVATED_KEY [] = "Elevated" |
static const char | NOFRIENDLYFIRE_KEY [] = "NoFriendlyFire" |
static const char | MAINFACILITY_KEY [] = "MainFacility" |
static const char | HITPOINTS_KEY [] = "HitPoints" |
static const char | BUILD_KEY [] = "Build" |
static const char | MANA_KEY [] = "Mana" |
static const char | TRANSPORT_KEY [] = "Transport" |
static const char | RESEARCH_KEY [] = "Research" |
static const char | TRAINING_KEY [] = "Training" |
static const char | UPGRADETO_KEY [] = "UpgradeTo" |
static const char | GIVERESOURCE_KEY [] = "GiveResource" |
static const char | CARRYRESOURCE_KEY [] = "CarryResource" |
static const char | XP_KEY [] = "Xp" |
static const char | KILL_KEY [] = "Kill" |
static const char | SUPPLY_KEY [] = "Supply" |
static const char | DEMAND_KEY [] = "Demand" |
static const char | ARMOR_KEY [] = "Armor" |
static const char | SIGHTRANGE_KEY [] = "SightRange" |
static const char | ATTACKRANGE_KEY [] = "AttackRange" |
static const char | PIERCINGDAMAGE_KEY [] = "PiercingDamage" |
static const char | BASICDAMAGE_KEY [] = "BasicDamage" |
static const char | POSX_KEY [] = "PosX" |
static const char | POSY_KEY [] = "PosY" |
static const char | POS_RIGHT_KEY [] = "PosRight" |
static const char | POS_BOTTOM_KEY [] = "PosBottom" |
static const char | TARGETPOSX_KEY [] = "TargetPosX" |
static const char | TARGETPOSY_KEY [] = "TargetPosY" |
static const char | RADARRANGE_KEY [] = "RadarRange" |
static const char | RADARJAMMERRANGE_KEY [] = "RadarJammerRange" |
static const char | AUTOREPAIRRANGE_KEY [] = "AutoRepairRange" |
static const char | BLOODLUST_KEY [] = "Bloodlust" |
static const char | HASTE_KEY [] = "Haste" |
static const char | SLOW_KEY [] = "Slow" |
static const char | INVISIBLE_KEY [] = "Invisible" |
static const char | UNHOLYARMOR_KEY [] = "UnholyArmor" |
static const char | SLOT_KEY [] = "Slot" |
static const char | SHIELD_KEY [] = "ShieldPoints" |
static const char | POINTS_KEY [] = "Points" |
static const char | MAXHARVESTERS_KEY [] = "MaxHarvesters" |
static const char | POISON_KEY [] = "Poison" |
static const char | SHIELDPERMEABILITY_KEY [] = "ShieldPermeability" |
static const char | SHIELDPIERCING_KEY [] = "ShieldPiercing" |
static const char | ISALIVE_KEY [] = "IsAlive" |
static const char | PLAYER_KEY [] = "Player" |
static const char | PRIORITY_KEY [] = "Priority" |
static const std::string | shadowMarker = std::string("MARKER") |
int | GetSpriteIndex (const char *SpriteName) |
unsigned | CclGetResourceByName (lua_State *l) |
Get resource by name. More... | |
int | ExtraDeathIndex (const char *death) |
Get the suitable animation frame depends of unit's damaged type. More... | |
static void | ParseBuildingRules (lua_State *l, std::vector< CBuildRestriction * > &blist) |
static void | UpdateDefaultBoolFlags (CUnitType &type) |
static int | CclDefineUnitType (lua_State *l) |
static int | CclCopyUnitType (lua_State *l) |
static int | CclDefineUnitStats (lua_State *l) |
CUnitType * | CclGetUnitType (lua_State *l) |
static int | CclUnitType (lua_State *l) |
static int | CclUnitTypeArray (lua_State *l) |
static int | CclGetUnitTypeIdent (lua_State *l) |
static int | CclGetUnitTypeName (lua_State *l) |
static int | CclSetUnitTypeName (lua_State *l) |
static int | CclGetUnitTypeData (lua_State *l) |
void | DefineVariableField (lua_State *l, CVariable *var, int lua_index) |
Cleanup unit-type module. More... | |
static int | CclDefineVariables (lua_State *l) |
static int | CclDefineBoolFlags (lua_State *l) |
static int | CclDefineDecorations (lua_State *l) |
static int | CclDefineExtraDeathTypes (lua_State *l) |
static int | CclDefinePaletteSwap (lua_State *l) |
void | UpdateUnitVariables (CUnit &unit) |
Update custom Variables with other variable (like Hp, ...) More... | |
void | SetMapStat (std::string ident, std::string variable_key, int value, std::string variable_type) |
void | SetMapSound (std::string ident, std::string sound, std::string sound_type, std::string sound_subtype) |
void | UnitTypeCclRegister () |
Access unit-type object. More... | |
|
static |
Description
Copy a unit type.
l | Lua state. |
Example:
CopyUnitType("unit-peasant", "unit-peasant-copy")
|
static |
Define boolean flag.
l | Lua state. |
|
static |
Define Decorations for user variables
l | Lua state. |
modify Assert with luastate with User Error.
continue to add configuration.
|
static |
Define default extra death types.
l | Lua state. |
|
static |
|
static |
Description
Parse unit-stats.
l | Lua state. |
Example:
DefineUnitStats("unit-berserker", 2, { "HitPoints", {Value = 55, Max = 55, Increase = 0, Enable = true}, "AttackRange", {Value = 5, Max = 6, Increase = 0, Enable = true}, "SightRange", {Value = 7, Max = 7, Increase = 0, Enable = true}, })
|
static |
Description
Parse unit-type.
l | Lua state. |
Example:
DefineUnitType("unit-silvermoon-archer", { Name = _("Silvermoon Archer"), Image = {"file", "human/units/elven_archer.png", "size", {72, 72}}, Animations = "animations-archer", Icon = "icon-archer", Costs = {"time", 70, "gold", 500, "wood", 50}, Speed = 10, HitPoints = 45, DrawLevel = 40, TileSize = {1, 1}, BoxSize = {33, 33}, SightRange = 6, ComputerReactionRange = 7, PersonReactionRange = 6, BasicDamage = 4, PiercingDamage = 6, Missile = "missile-arrow", MaxAttackRange = 4, Priority = 75, Points = 60, Demand = 1, Corpse = "unit-human-dead-body", Type = "land", RightMouseAction = "attack", CanAttack = true, CanTargetLand = true, CanTargetSea = true, CanTargetAir = true, LandUnit = true, organic = true, SelectableByRectangle = true, Sounds = { "selected", "archer-selected", "acknowledge", "archer-acknowledge", "ready", "archer-ready", "help", "basic human voices help 1", "dead", "basic human voices dead"} } )
|
static |
Define user variables.
l | Lua state. |
unsigned CclGetResourceByName | ( | lua_State * | l | ) |
Get resource by name.
Get the resource ID from a SCM object.
l | Lua state. |
CUnitType* CclGetUnitType | ( | lua_State * | l | ) |
Access unit-type object
l | Lua state. |
|
static |
Description
Get unit type data.
l | Lua state. |
Example:
– Get the amount of supply from Human Farms supply = GetUnitTypeData("unit-farm","Supply") print(supply)
|
static |
Get the ident of the unit-type structure.
l | Lua state. |
|
static |
Description
Get the name of the unit-type structure.
l | Lua state. |
Example:
name = GetUnitTypeName("unit-knight") print(name)
|
static |
Description
Set the name of the unit-type structure.
l | Lua state. |
Example:
SetUnitTypeName("unit-beast-cry","Doomhammer")
|
static |
Get unit-type structure.
l | Lua state. |
|
static |
Get all unit-type structures.
l | Lua state. |
Cleanup unit-type module.
Define the field of the UserDefined variables.
l | Lua state. |
var | Variable to set. |
lua_index | Index of the table where are the infos |
int ExtraDeathIndex | ( | const char * | death | ) |
Get the suitable animation frame depends of unit's damaged type.
Find the index of a extra death type
int GetSpriteIndex | ( | const char * | SpriteName | ) |
Return the index of the sprite named SpriteName.
SpriteName | Name of the sprite. |
|
static |
Parse BuildingRules
l | Lua state. |
blist | BuildingRestriction to fill in |
void SetMapSound | ( | std::string | ident, |
std::string | sound, | ||
std::string | sound_type, | ||
std::string | sound_subtype | ||
) |
Set the map sound for a unit type
ident | Unit type ident |
sound_type | Type of the sound |
sound | The sound to be set for that type |
void SetMapStat | ( | std::string | ident, |
std::string | variable_key, | ||
int | value, | ||
std::string | variable_type | ||
) |
Set the map default stat for a unit type
ident | Unit type ident |
variable_key | Key of the desired variable |
value | Value to set to |
variable_type | Type to be modified (i.e. "Value", "Max", etc.); alternatively, resource type if variable_key equals "Costs" |
void UnitTypeCclRegister | ( | ) |
Access unit-type object.
Register CCL features for unit-type.
Update custom Variables with other variable (like Hp, ...)
Update unit variables which are not user defined.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Variables for UnitType and unit.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
CUnitTypeVar UnitTypeVar |
|
static |
|
static |
|
static |
|
static |
|
static |