Bazaar developer reference

CvLuaUnit::PushMethods(lua_State *, int)

Defined in
Lua/CvLuaUnit.cpp, line 29
Class
CvLuaUnit
Hook name
CivHooks::CvLuaUnit_PushMethods

Hooks

static bool BeforeCvLuaUnit_PushMethods(lua_State* L, int t);static void AfterCvLuaUnit_PushMethods(lua_State* L, int t);static void ReplaceCvLuaUnit_PushMethods(void (*original)(lua_State*, int), lua_State* L, int t);CivRegisterBefore<CivHooks::CvLuaUnit_PushMethods>(host, &BeforeCvLuaUnit_PushMethods);CivRegisterAfter<CivHooks::CvLuaUnit_PushMethods>(host, &AfterCvLuaUnit_PushMethods);CivRegisterReplace<CivHooks::CvLuaUnit_PushMethods>(host, &ReplaceCvLuaUnit_PushMethods);

Code

29void CvLuaUnit::PushMethods(lua_State* L, int t)30{31	Method(IsNone);32	Method(Convert);33#if defined(MOD_API_LUA_EXTENSIONS)34	Method(Upgrade);35	Method(UpgradeTo);36#endif37	Method(Kill);3839	Method(IsActionRecommended);40	Method(IsBetterDefenderThan);4142	Method(CanDoCommand);43	Method(DoCommand);4445	Method(GetPathEndTurnPlot);46	Method(GeneratePath);47#if defined(MOD_API_LUA_EXTENSIONS)48	Method(GetActivePath);49#endif5051	Method(CanEnterTerritory);52	Method(GetDeclareWarRangeStrike);53	Method(CanMoveOrAttackInto);54	Method(CanMoveThrough);55	Method(JumpToNearestValidPlot);5657	Method(GetCombatDamage);58	Method(GetFireSupportUnit);5960	Method(CanAutomate);61	Method(CanScrap);62	Method(GetScrapGold);63	Method(CanGift);64	Method(CanDistanceGift);65	Method(CanLoadUnit);66	Method(CanLoad);67	Method(CanUnload);68	Method(CanUnloadAll);69	Method(CanHold);70	Method(CanSleep);71	Method(CanFortify);72	Method(CanAirPatrol);73	Method(IsEmbarked);74	Method(SetEmbarked);75	Method(CanHeal);76	Method(CanSentry);77	Method(CanEmbark);78	Method(CanDisembark);79	Method(CanEmbarkOnto);80	Method(CanDisembarkOnto);81	Method(CanRebaseAt);82#if defined(MOD_API_LUA_EXTENSIONS)83	Method(RebaseAt);84#endif85	Method(Embark);8687	Method(IsRangeAttackIgnoreLOS);8889	Method(CanAirlift);90	Method(CanAirliftAt);9192	Method(IsNukeVictim);93	Method(CanNuke);94	Method(CanNukeAt);9596	Method(CanRangeStrike);97	Method(CanRangeStrikeAt);9899	Method(CanParadrop);100	Method(CanParadropAt);101102	Method(CanMakeTradeRoute);103	Method(CanMakeTradeRouteAt);104105#if defined(MOD_API_LUA_EXTENSIONS) && defined(MOD_API_TRADEROUTES)106	Method(CanPlunderTradeRoute);107	Method(PlunderTradeRoute);108#endif109110#if defined(MOD_API_LUA_EXTENSIONS)111	Method(CanCreateGreatWork);112	Method(CreateGreatWork);113#endif114115	Method(GetExoticGoodsGoldAmount);116	Method(GetExoticGoodsXPAmount);117118	Method(CanPillage);119120	Method(IsSelected);121122	Method(CanFound);123	Method(CanJoin);124	Method(CanConstruct);125126	Method(CanDiscover);127	Method(GetDiscoverAmount);128	Method(GetHurryProduction);129	Method(GetTradeGold);130	Method(GetTradeInfluence);131	Method(CanTrade);132	Method(CanBuyCityState);133	Method(CanRepairFleet);134#if defined(MOD_API_LUA_EXTENSIONS) && defined(MOD_GLOBAL_SEPARATE_GREAT_ADMIRAL)135	Method(CanChangePort);136#endif137	Method(CanBuildSpaceship);138139	Method(CanGoldenAge);140	Method(GetGoldenAgeTurns);141	Method(GetGivePoliciesCulture);142	Method(GetBlastTourism);143	Method(CanBuild);144	Method(CanLead);145	Method(Lead);146	Method(CanGiveExperience);147	Method(GiveExperience);148149	Method(CanPromote);150	Method(Promote);151152#if defined(MOD_API_UNIT_STATS)153	Method(GetStatsTravelled);154	Method(SetStatsTravelled);155	Method(ChangeStatsTravelled);156	Method(GetStatsKilled);157	Method(SetStatsKilled);158	Method(ChangeStatsKilled);159#endif160161	Method(GetUpgradeUnitType);162	Method(UpgradePrice);163	Method(CanUpgradeRightNow);164#if defined(MOD_API_LUA_EXTENSIONS)165	Method(CanUpgradeTo);166#endif167#if defined(MOD_API_LUA_EXTENSIONS) && defined(MOD_GLOBAL_CS_UPGRADES)168	Method(CanUpgradeInTerritory);169#endif170	Method(GetNumResourceNeededToUpgrade);171172	Method(GetHandicapType);173	Method(GetCivilizationType);174	Method(GetSpecialUnitType);175	Method(GetCaptureUnitType);176	Method(GetUnitCombatType);177#if defined(MOD_API_LUA_EXTENSIONS) && defined(MOD_GLOBAL_PROMOTION_CLASSES)178	Method(GetUnitPromotionType);179#endif180	Method(GetUnitAIType);181	Method(SetUnitAIType);182	Method(GetDomainType);183	Method(GetInvisibleType);184	Method(GetSeeInvisibleType);185	Method(GetDropRange);186187	Method(FlavorValue);188	Method(IsBarbarian);189190	Method(IsHuman);191	Method(VisibilityRange);192193	Method(MaxMoves);194	Method(MovesLeft);195196	Method(CanMove);197	Method(HasMoved);198	Method(Range);199	Method(NukeDamageLevel);200201	Method(CanBuildRoute);202	Method(GetBuildType);203	Method(WorkRate);204205	Method(IsNoBadGoodies);206	Method(IsOnlyDefensive);207208	Method(IsNoCapture);209	Method(IsRivalTerritory);210	Method(IsFound);211#if defined(MOD_API_LUA_EXTENSIONS)212	Method(IsFoundAbroad);213#endif214	Method(IsWork);215	Method(IsGoldenAge);216	Method(CanCoexistWithEnemyUnit);217218	Method(IsGreatPerson);219220	Method(IsFighting);221	Method(IsAttacking);222	Method(IsDefending);223	Method(IsInCombat);224225#if defined(MOD_API_LUA_EXTENSIONS) && defined(MOD_UNITS_MAX_HP)226	Method(GetMaxHitPointsBase);227	Method(SetMaxHitPointsBase);228	Method(ChangeMaxHitPointsBase);229#endif230	Method(GetMaxHitPoints);231	Method(GetCurrHitPoints);232	Method(IsHurt);233	Method(IsDead);234	Method(IsDelayedDeath);235	Method(SetBaseCombatStrength);236	Method(GetBaseCombatStrength);237238	Method(GetMaxAttackStrength);239	Method(GetMaxDefenseStrength);240	Method(GetEmbarkedUnitDefense);241242	Method(IsCombatUnit);243	Method(IsCanDefend);244	Method(CanSiege);245	Method(IsCanAttackWithMove);246	Method(IsCanAttackRanged);247	Method(IsCanAttack);248	Method(IsCanAttackWithMoveNow);249	Method(IsEnemyInMovementRange);250251	Method(IsTrade);252#if defined(MOD_API_LUA_EXTENSIONS) && defined(MOD_API_TRADEROUTES)253	Method(GetTradeRouteIndex);254	Method(IsRecalledTrader);255	Method(RecallTrader);256	Method(EndTrader);257#endif258259	Method(GetBaseRangedCombatStrength);260#if defined(MOD_API_EXTENSIONS)261	Method(SetBaseRangedCombatStrength);262#endif263	Method(GetMaxRangedCombatStrength);264	Method(GetCombatLimit);265	Method(GetRangedCombatLimit);266	Method(CanAirAttack);267	Method(CanAirDefend);268	Method(GetAirCombatDamage);269	Method(GetRangeCombatDamage);270	Method(GetAirStrikeDefenseDamage);271	Method(GetBestInterceptor);272	Method(GetInterceptorCount);273	Method(GetBestSeaPillageInterceptor);274	Method(GetCaptureChance);275276	Method(IsAutomated);277	Method(IsWaiting);278	Method(IsFortifyable);279	Method(IsEverFortifyable);280	Method(FortifyModifier);281	Method(ExperienceNeeded);282	Method(AttackXPValue);283	Method(DefenseXPValue);284	Method(MaxXPValue);285	Method(FirstStrikes);286	Method(ChanceFirstStrikes);287	Method(MaxFirstStrikes);288	Method(IsRanged);289	Method(IsMustSetUpToRangedAttack);290	Method(CanSetUpForRangedAttack);291	Method(IsSetUpForRangedAttack);292	Method(ImmuneToFirstStrikes);293	Method(NoDefensiveBonus);294	Method(IgnoreBuildingDefense);295	Method(CanMoveImpassable);296	Method(CanMoveAllTerrain);297#if defined(MOD_API_LUA_EXTENSIONS)298	Method(IsHoveringUnit);299#endif300	Method(FlatMovementCost);301	Method(IgnoreTerrainCost);302#if defined(MOD_API_LUA_EXTENSIONS) && defined(MOD_API_PLOT_BASED_DAMAGE)303	Method(IgnoreTerrainDamage);304	Method(IgnoreFeatureDamage);305	Method(ExtraTerrainDamage);306	Method(ExtraFeatureDamage);307#endif308#if defined(MOD_API_LUA_EXTENSIONS) && defined(MOD_PROMOTIONS_IMPROVEMENT_BONUS)309	Method(GetNearbyImprovementCombatBonus);310	Method(GetNearbyImprovementBonusRange);311	Method(GetCombatBonusImprovement);312#endif313#if defined(MOD_API_LUA_EXTENSIONS) && defined(MOD_PROMOTIONS_CROSS_MOUNTAINS)314	Method(CanCrossMountains);315#endif316#if defined(MOD_API_LUA_EXTENSIONS) && defined(MOD_PROMOTIONS_CROSS_OCEANS)317	Method(CanCrossOceans);318#endif319#if defined(MOD_API_LUA_EXTENSIONS) && defined(MOD_PROMOTIONS_CROSS_ICE)320	Method(CanCrossIce);321#endif322#if defined(MOD_API_LUA_EXTENSIONS) && defined(MOD_PROMOTIONS_GG_FROM_BARBARIANS)323	Method(IsGGFromBarbarians);324#endif325	Method(IsNeverInvisible);326	Method(IsInvisible);327	Method(IsNukeImmune);328	Method(IsRangeAttackOnlyInDomain);329	Method(IsCityAttackOnly);330331	Method(MaxInterceptionProbability);332	Method(CurrInterceptionProbability);333	Method(EvasionProbability);334	Method(WithdrawalProbability);335336	Method(GetAdjacentModifier);337	Method(GetAttackModifier);338	Method(GetDefenseModifier);339	Method(GetRangedAttackModifier);340	Method(CityAttackModifier);341	Method(CityDefenseModifier);342	Method(HillsAttackModifier);343	Method(HillsDefenseModifier);344	Method(RoughAttackModifier);345	Method(OpenAttackModifier);346	Method(OpenRangedAttackModifier);347	Method(OpenDefenseModifier);348	Method(RoughRangedAttackModifier);349	Method(AttackFortifiedModifier);350	Method(AttackWoundedModifier);351	Method(FlankAttackModifier);352	Method(RoughDefenseModifier);353	Method(TerrainAttackModifier);354	Method(TerrainDefenseModifier);355	Method(FeatureAttackModifier);356	Method(FeatureDefenseModifier);357	Method(UnitClassAttackModifier);358	Method(UnitClassDefenseModifier);359	Method(UnitCombatModifier);360	Method(DomainModifier);361	Method(GetStrategicResourceCombatPenalty);362	Method(GetUnhappinessCombatPenalty);363	Method(AirSweepCombatMod);364	Method(CapitalDefenseModifier);365	Method(CapitalDefenseFalloff);366367	Method(SpecialCargo);368	Method(DomainCargo);369	Method(CargoSpace);370	Method(ChangeCargoSpace);371	Method(IsFull);372	Method(CargoSpaceAvailable);373	Method(HasCargo);374	Method(CanCargoAllMove);375	Method(GetUnitAICargo);376	Method(GetID);377378	Method(GetHotKeyNumber);379	Method(SetHotKeyNumber);380381	Method(GetX);382	Method(GetY);383#if defined(MOD_API_LUA_EXTENSIONS)384	Method(GetXY);385#endif386	Method(SetXY);387	Method(At);388	Method(AtPlot);389	Method(GetPlot);390	Method(GetArea);391	Method(GetReconPlot);392	Method(SetReconPlot);393394	Method(GetGameTurnCreated);395	Method(GetLastMoveTurn);396397	Method(GetDamage);398	Method(SetDamage);399	Method(ChangeDamage);400	Method(GetMoves);401	Method(SetMoves);402	Method(ChangeMoves);403	Method(FinishMoves);404	Method(IsImmobile);405406	Method(GetExperience);407	Method(SetExperience);408	Method(ChangeExperience);409#if defined(MOD_API_LUA_EXTENSIONS) && defined(MOD_UNITS_XP_TIMES_100)410	Method(GetExperienceTimes100);411	Method(SetExperienceTimes100);412	Method(ChangeExperienceTimes100);413#endif414	Method(GetLevel);415	Method(SetLevel);416	Method(ChangeLevel);417	Method(GetFacingDirection);418	Method(RotateFacingDirectionClockwise);419	Method(RotateFacingDirectionCounterClockwise);420	Method(GetCargo);421	Method(GetFortifyTurns);422	Method(GetBlitzCount);423	Method(IsBlitz);424	Method(GetAmphibCount);425	Method(IsAmphib);426	Method(GetRiverCrossingNoPenaltyCount);427	Method(IsRiverCrossingNoPenalty);428	Method(IsEnemyRoute);429	Method(IsAlwaysHeal);430	Method(IsHealOutsideFriendly);431	Method(IsHillsDoubleMove);432	Method(IsGarrisoned);433	Method(GetGarrisonedCity);434435	Method(GetExtraVisibilityRange);436#if defined(MOD_API_LUA_EXTENSIONS) && defined(MOD_PROMOTIONS_VARIABLE_RECON)437	Method(GetExtraReconRange);438#endif439	Method(GetExtraMoves);440	Method(GetExtraMoveDiscount);441	Method(GetExtraRange);442	Method(GetExtraIntercept);443	Method(GetExtraEvasion);444	Method(GetExtraFirstStrikes);445	Method(GetExtraChanceFirstStrikes);446	Method(GetExtraWithdrawal);447	Method(GetExtraEnemyHeal);448	Method(GetExtraNeutralHeal);449	Method(GetExtraFriendlyHeal);450451	Method(GetSameTileHeal);452	Method(GetAdjacentTileHeal);453454	Method(GetExtraCombatPercent);455	Method(GetFriendlyLandsModifier);456	Method(GetFriendlyLandsAttackModifier);457	Method(GetOutsideFriendlyLandsModifier);458	Method(GetExtraCityAttackPercent);459	Method(GetExtraCityDefensePercent);460	Method(GetExtraHillsAttackPercent);461	Method(GetExtraHillsDefensePercent);462463	Method(GetExtraOpenAttackPercent);464	Method(GetExtraOpenRangedAttackMod);465	Method(GetExtraRoughAttackPercent);466	Method(GetExtraRoughRangedAttackMod);467	Method(GetExtraAttackFortifiedMod);468	Method(GetExtraAttackWoundedMod);469	Method(GetExtraOpenDefensePercent);470471	Method(GetPillageChange);472	Method(GetUpgradeDiscount);473	Method(GetExperiencePercent);474	Method(GetKamikazePercent);475476477	Method(IsOutOfAttacks);478	Method(SetMadeAttack);479	Method(isOutOfInterceptions);480	Method(SetMadeInterception);481482	Method(IsPromotionReady);483	Method(SetPromotionReady);484	Method(GetOwner);485	Method(GetVisualOwner);486	Method(GetCombatOwner);487	Method(GetOriginalOwner);488	Method(SetOriginalOwner);489	Method(GetTeam);490	Method(GetUnitFlagIconOffset);491	Method(GetUnitPortraitOffset);492493	Method(GetUnitType);494	Method(GetUnitClassType);495	Method(GetLeaderUnitType);496	Method(SetLeaderUnitType);497	Method(IsNearGreatGeneral);498	Method(IsStackedGreatGeneral);499	Method(IsIgnoreGreatGeneralBenefit);500	Method(GetReverseGreatGeneralModifier);501	Method(GetGreatGeneralCombatModifier);502#if defined(MOD_API_LUA_EXTENSIONS) && defined(MOD_PROMOTIONS_AURA_CHANGE)503	Method(GetAuraRange);504	Method(GetAuraEffect);505#endif506	Method(IsNearSapper);507	Method(GetNearbyImprovementModifier);508	Method(IsFriendlyUnitAdjacent);509	Method(GetNumEnemyUnitsAdjacent);510	Method(IsEnemyCityAdjacent);511512	Method(GetTransportUnit);513	Method(IsCargo);514515	Method(GetExtraDomainModifier);516517	Method(GetName);518	Method(GetNameNoDesc);519	Method(HasName);520	Method(GetNameKey);521	Method(SetName);522	Method(IsTerrainDoubleMove);523	Method(IsFeatureDoubleMove);524#if defined(MOD_API_LUA_EXTENSIONS) && defined(MOD_PROMOTIONS_HALF_MOVE)525	Method(IsTerrainHalfMove);526	Method(IsFeatureHalfMove);527#endif528529	Method(GetScriptData);530	Method(SetScriptData);531	Method(GetScenarioData);532	Method(SetScenarioData);533534	Method(GetExtraTerrainAttackPercent);535	Method(GetExtraTerrainDefensePercent);536	Method(GetExtraFeatureAttackPercent);537	Method(GetExtraFeatureDefensePercent);538	Method(GetExtraUnitCombatModifier);539	Method(GetUnitClassModifier);540541	Method(CanAcquirePromotion);542	Method(CanAcquirePromotionAny);543	Method(IsPromotionValid);544	Method(IsHasPromotion);545	Method(SetHasPromotion);546547#if defined(MOD_API_LUA_EXTENSIONS)548	Method(SetActivityType);549#endif550	Method(GetActivityType);551	Method(IsReadyToMove);552	Method(IsBusy);553554	Method(GetReligion);555	Method(GetConversionStrength);556	Method(GetSpreadsLeft);557	Method(GetNumFollowersAfterSpread);558	Method(GetMajorityReligionAfterSpread);559#if defined(MOD_API_LUA_EXTENSIONS)560	Method(SetReligion);561	Method(SetConversionStrength);562	Method(SetSpreadsLeft);563#endif564565	Method(GetTourismBlastStrength);566567	Method(GetGreatWorkSlotType);568569	// Helper Functions570	Method(RangeStrike);571572	Method(PushMission);573	Method(PopMission);574	Method(LastMissionPlot);575	Method(CanStartMission);576577	Method(ExecuteSpecialExploreMove);578579	Method(SetDeployFromOperationTurn);580	Method(IsHigherTechThan);581	Method(IsLargerCivThan);582583	Method(IsRangedSupportFire);584585#if defined(MOD_API_LUA_EXTENSIONS)586	Method(AddMessage);587#endif588589#if defined(MOD_API_LUA_EXTENSIONS)590	Method(IsCivilization);591	Method(HasPromotion);592	Method(IsUnit);593	Method(IsUnitClass);594	Method(IsOnFeature);595	Method(IsAdjacentToFeature);596	Method(IsWithinDistanceOfFeature);597	Method(IsOnImprovement);598	Method(IsAdjacentToImprovement);599	Method(IsWithinDistanceOfImprovement);600	Method(IsOnPlotType);601	Method(IsAdjacentToPlotType);602	Method(IsWithinDistanceOfPlotType);603	Method(IsOnResource);604	Method(IsAdjacentToResource);605	Method(IsWithinDistanceOfResource);606	Method(IsOnTerrain);607	Method(IsAdjacentToTerrain);608	Method(IsWithinDistanceOfTerrain);609#endif610}

Calls