New feature: factories allows facilities to create items

For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=360075&#msg_360075

git-svn-id: https://ja2svn.mooo.com/source/ja2_v1.13_data@2534 4f8fa57e-7814-0410-bad4-adc449f26b7c
This commit is contained in:
Flugente
2020-05-17 20:50:47 +00:00
parent acc8f44df8
commit 93da107e60
7 changed files with 565 additions and 5 deletions
+49 -2
View File
@@ -77,6 +77,7 @@ Facts = {
FACT_MARIA_ESCORTED = 116,
FACT_ANGEL_LEFT_DEED = 120,
FACT_CHALICE_STOLEN = 184,
FACT_CONVO_ERNEST = 215,
FACT_MUSEUM_ALARM_WENT_OFF = 278,
FACT_KINGPIN_KNOWS_MONEY_GONE = 103,
FACT_KINGPIN_DEAD = 308,
@@ -189,6 +190,19 @@ Profil =
ELDIN = 127,
ELLIOT = 135,
MADLAB = 146,
DARYL = 150,
}
Flags1 =
{
PROFILE_MISC_FLAG_RECRUITED = 1,
PROFILE_MISC_FLAG_HAVESEENCREATURE = 2,
PROFILE_MISC_FLAG_FORCENPCQUOTE = 4,
PROFILE_MISC_FLAG_WOUNDEDBYPLAYER = 8,
PROFILE_MISC_FLAG_TEMP_NPC_QUOTE_DATA_EXISTS = 16,
PROFILE_MISC_FLAG_SAID_HOSTILE_QUOTE = 32,
PROFILE_MISC_FLAG_EPCACTIVE = 64,
PROFILE_MISC_FLAG_ALREADY_USED_ITEMS = 128,
}
SoldierClass =
@@ -364,6 +378,35 @@ Languages =
LANGUAGE_CHINESE = 7,
}
-- sSectorX, sSectorY and bSectorZ indicate the sector coordinates
-- usFacilityType is facility number from FacilitTypes.xml
-- usProductionNumber denotes which FACTORY of the facility this is for
-- sProgressLeft is the progress to be saved.
--
-- As factories can be added or removed in the xml at will, we can't hardcode their progress in the savegame.
-- Therefore we let the modder store their progress in here via LUAFacts into the modder-administered part of the savefile.
-- We also want factories to be deactivated initially (so the player doesn't suddenly lose money if he takes their sector). Initially all values are 0.
-- In the code, values < 0 indicate a factory is offline, >= 0 online.
-- We thus add '1' to every value, so we store the progress as 1 + sProgressLeft, this means a luafact value of <= 0 is offline, > 0 is online
--
-- We also use the Getter to check for other conditions, like quest progress. For example, even if we control Drassen, we can only use the T-Shirt factory once Doreen is gone.
-- We achieve that by returning a value < -10 if these extra conditions are not satisfied.
-- The code checks that too and won't allow us to even turn a factory on in this case, so the player knows he has something else to do first.
function SetFactoryLeftoverProgress(sSectorX, sSectorY, bSectorZ, usFacilityType, usProductionNumber, sProgressLeft)
end
function GetFactoryLeftoverProgress(sSectorX, sSectorY, bSectorZ, usFacilityType, usProductionNumber, sProgressLeft)
val = -1
return val
end
-- this function is called whenever we liberate a sector. If fFirstTime is true, this is the first time we liberate this sector
function HandleSectorLiberation( sNewSectorX, sNewSectorY, bNewSectorZ, fFirstTime )
@@ -450,12 +493,16 @@ MapSymbols = {
FLAG = 10,
QUESTIONMARK_BLUE = 11, -- sector might be relevant for a quest
EXCLAMATIONMARK_BLUE = 12, -- sector is definetely relevant for a quest
QUESTIONMARK_GREEN = 13, -- alternate colours for other uses?
QUESTIONMARK_GREEN = 13, -- alternate colours for other uses
EXCLAMATIONMARK_GREEN = 14,
QUESTIONMARK_RED = 15,
EXCLAMATIONMARK_RED = 16,
QUESTIONMARK_YELLOW = 17,
EXCLAMATIONMARK_YELLOW = 18,
EXCLAMATIONMARK_YELLOW = 18,
FACTORY_YELLOW = 19,
FACTORY_GREEN = 20,
FACTORY_RED = 21,
FACTORY_NOCONTROL = 22,
}
-- this function allows us to data for the intel/quest map