From 72d567a06ed9294f9aad786cecb22fea911d2a73 Mon Sep 17 00:00:00 2001 From: Flugente Date: Wed, 5 Oct 2016 21:55:45 +0000 Subject: [PATCH] New feature: SAM site cover can now overlap, and SAM sited can be hacked to lower their radius. For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=23211&goto=347188&#msg_347188 git-svn-id: https://ja2svn.mooo.com/source/ja2_v1.13_data@2343 4f8fa57e-7814-0410-bad4-adc449f26b7c --- gamedir/Data-1.13/Scripts/Overhead.lua | 171 ++++++++++++++++-- .../TableData/Map/InteractiveActions.xml | 8 +- gamedir/Data-1.13/TableData/Map/SamSites.xml | 58 ++++-- 3 files changed, 204 insertions(+), 33 deletions(-) diff --git a/gamedir/Data-1.13/Scripts/Overhead.lua b/gamedir/Data-1.13/Scripts/Overhead.lua index 44e35d6ba..0ab67e631 100644 --- a/gamedir/Data-1.13/Scripts/Overhead.lua +++ b/gamedir/Data-1.13/Scripts/Overhead.lua @@ -203,6 +203,15 @@ StatTypes = LDRAMT = 11, } +-- different teams +Teams = +{ + ENEMY_TEAM = 1, + CREATURE_TEAM = 2, + MILITIA_TEAM = 3, + CIV_TEAM = 4, +} + local iLoop local aimLoop @@ -667,7 +676,7 @@ function HandleInteractiveActionResult(sSectorX, sSectorY, bSectorZ, sGridNo, bL SetScreenMsg(FontColour.FONT_MCOLOR_LTGREEN, "It seems an even more advance version of the rocket rifle has been developed.") SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "Several files seem to be missing... you can't find the weapon specifics.") SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "The advanced version never developed further than the prototypes stage.") - SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "It is not known where those 2 prototypes are.") + SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "It is not specified where the prototypes are.") end -- money elseif ( sLuaactionid == ModSpecificActions.COMPUTER_ORTA_BASEMENT_LAB2_PC ) then @@ -705,7 +714,7 @@ function HandleInteractiveActionResult(sSectorX, sSectorY, bSectorZ, sGridNo, bL elseif ( sLuaactionid == ModSpecificActions.COMPUTER_ORTA_BASEMENT_CONTROL_CONSOLE_2 ) then if ( GetModderLUAFact(sLuaactionid) == ActionState.STATE_OK ) then SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "This base seems to have different levels of clearance.") - SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "Some of the storage rooms are hevily fortified.") + SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "Some of the storage rooms are heavily fortified.") SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "Explosives likely won't be enough, these doors require a key code.") SetScreenMsg(FontColour.FONT_MCOLOR_LTGREEN, "It is likely the lead scientists or guards might have the key codes.") SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "The files don't say what exactly is stored here though.") @@ -718,10 +727,10 @@ function HandleInteractiveActionResult(sSectorX, sSectorY, bSectorZ, sGridNo, bL elseif ( sLuaactionid == ModSpecificActions.COMPUTER_ORTA_BASEMENT_ENTRANCE_CONSOLE_1 ) then if ( GetModderLUAFact(sLuaactionid) == ActionState.STATE_OK ) then SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "A log lists recent arrivals and departures to this base.") - SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "For a long time, this base onyl received supplies.") + SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "For a long time, this base only received supplies.") SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "But recently, quite a few shipments were sent from here to Meduna.") SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "The logs don't say what was shipped, but the destination was the royal guard HQ.") - SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "This does not sound encouraging.") + SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "You have a bad feeling about this.") SetModderLUAFact(sLuaactionid, ActionState.STATE_GAVEREWARD_OK) elseif ( GetModderLUAFact(sLuaactionid) == ActionState.STATE_GAVEREWARD_OK ) then @@ -786,7 +795,7 @@ function HandleInteractiveActionResult(sSectorX, sSectorY, bSectorZ, sGridNo, bL elseif ( GetModderLUAFact(sLuaactionid) == ActionState.STATE_GAVEREWARD_OK ) then SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "Apart from the chalice, the museum doesn't seem to have anything of interest.") end - -- Drassen SAM: get info from the pc and use the comman console + -- Drassen SAM: get info from the pc and use the command console elseif ( sLuaactionid == ModSpecificActions.COMPUTER_DRASSENSAM_PC_1 ) then if ( GetModderLUAFact(sLuaactionid) == ActionState.STATE_OK ) then SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "We've compromised an army personnel database!") @@ -815,9 +824,43 @@ function HandleInteractiveActionResult(sSectorX, sSectorY, bSectorZ, sGridNo, bL end elseif ( sLuaactionid == ModSpecificActions.COMPUTER_DRASSENSAM_COMMANDCONSOLE ) then if ( GetModderLUAFact(sLuaactionid) == ActionState.STATE_OK ) then + SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "This seems to be the console that controls the SAM.") - SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "You have no idea how this works.") - SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "You decide to not touch anything, you might break something.") + + samhackstatus = GetSamSiteHackStatus(sSectorX, sSectorY) + + ourhack = 100 - 2 * successpts + + if ( ourhack < 0 ) then + ourhack = 0 + end + + -- we can hack the SAM, decreasing its radius, or undo a previous hack + -- for simplicity, we will always hack a SAM if enemies are nearby - we are either infiltrating or figting the enemy in those cases + -- otherwise, we obviously control the SAM, so try to unhack it + if ( NumNonPlayerTeamInSector(sSectorX, sSectorY, Teams.ENEMY_TEAM) > 0 ) then + if ( ourhack >= samhackstatus ) then + SetScreenMsg(FontColour.FONT_MCOLOR_RED, "Someone already hacked this thing - and they broke it better than you could.") + else + SetSamSiteHackStatus(sSectorX, sSectorY, ourhack) + + SetScreenMsg(FontColour.FONT_MCOLOR_LTGREEN, "We've messed up the file system - they will need an expert to get this running again.") + end + else + if ( samhackstatus < 100 ) then + SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "You attempt to unhack it.") + + if ( ourhack <= samhackstatus ) then + SetSamSiteHackStatus(sSectorX, sSectorY, 100) + + SetScreenMsg(FontColour.FONT_MCOLOR_LTGREEN, "We are successful, the targetting software is working again.") + else + SetScreenMsg(FontColour.FONT_MCOLOR_RED, "Whoever hacked the controls was more capable then we are - we cannot release the controls.") + end + else + SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "The software seems to work just fine, better not mess with it.") + end + end end -- Chitzena SAM: get info from the pc and use the comman console elseif ( sLuaactionid == ModSpecificActions.COMPUTER_CHITZENASAM_PC_1 ) then @@ -866,9 +909,43 @@ function HandleInteractiveActionResult(sSectorX, sSectorY, bSectorZ, sGridNo, bL end elseif ( sLuaactionid == ModSpecificActions.COMPUTER_CHITZENASAM_COMMANDCONSOLE ) then if ( GetModderLUAFact(sLuaactionid) == ActionState.STATE_OK ) then + SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "This seems to be the console that controls the SAM.") - SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "You have no idea how this works.") - SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "You decide to not touch anything, you might break something.") + + samhackstatus = GetSamSiteHackStatus(sSectorX, sSectorY) + + ourhack = 100 - 2 * successpts + + if ( ourhack < 0 ) then + ourhack = 0 + end + + -- we can hack the SAM, decreasing its radius, or undo a previous hack + -- for simplicity, we will always hack a SAM if enemies are nearby - we are either infiltrating or figting the enemy in those cases + -- otherwise, we obviously control the SAM, so try to unhack it + if ( NumNonPlayerTeamInSector(sSectorX, sSectorY, Teams.ENEMY_TEAM) > 0 ) then + if ( ourhack >= samhackstatus ) then + SetScreenMsg(FontColour.FONT_MCOLOR_RED, "Someone already hacked this thing - and they broke it better than you could.") + else + SetSamSiteHackStatus(sSectorX, sSectorY, ourhack) + + SetScreenMsg(FontColour.FONT_MCOLOR_LTGREEN, "We've messed up the file system - they will need an expert to get this running again.") + end + else + if ( samhackstatus < 100 ) then + SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "You attempt to unhack it.") + + if ( ourhack <= samhackstatus ) then + SetSamSiteHackStatus(sSectorX, sSectorY, 100) + + SetScreenMsg(FontColour.FONT_MCOLOR_LTGREEN, "We are successful, the targetting software is working again.") + else + SetScreenMsg(FontColour.FONT_MCOLOR_RED, "Whoever hacked the controls was more capable then we are - we cannot release the controls.") + end + else + SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "The software seems to work just fine, better not mess with it.") + end + end end -- central SAM: get info from the pc and use the command console elseif ( sLuaactionid == ModSpecificActions.COMPUTER_CENTRALSAM_PC_1 ) then @@ -939,9 +1016,43 @@ function HandleInteractiveActionResult(sSectorX, sSectorY, bSectorZ, sGridNo, bL end elseif ( sLuaactionid == ModSpecificActions.COMPUTER_CENTRALSAM_COMMANDCONSOLE ) then if ( GetModderLUAFact(sLuaactionid) == ActionState.STATE_OK ) then + SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "This seems to be the console that controls the SAM.") - SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "You have no idea how this works.") - SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "You decide to not touch anything, you might break something.") + + samhackstatus = GetSamSiteHackStatus(sSectorX, sSectorY) + + ourhack = 100 - 2 * successpts + + if ( ourhack < 0 ) then + ourhack = 0 + end + + -- we can hack the SAM, decreasing its radius, or undo a previous hack + -- for simplicity, we will always hack a SAM if enemies are nearby - we are either infiltrating or figting the enemy in those cases + -- otherwise, we obviously control the SAM, so try to unhack it + if ( NumNonPlayerTeamInSector(sSectorX, sSectorY, Teams.ENEMY_TEAM) > 0 ) then + if ( ourhack >= samhackstatus ) then + SetScreenMsg(FontColour.FONT_MCOLOR_RED, "Someone already hacked this thing - and they broke it better than you could.") + else + SetSamSiteHackStatus(sSectorX, sSectorY, ourhack) + + SetScreenMsg(FontColour.FONT_MCOLOR_LTGREEN, "We've messed up the file system - they will need an expert to get this running again.") + end + else + if ( samhackstatus < 100 ) then + SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "You attempt to unhack it.") + + if ( ourhack <= samhackstatus ) then + SetSamSiteHackStatus(sSectorX, sSectorY, 100) + + SetScreenMsg(FontColour.FONT_MCOLOR_LTGREEN, "We are successful, the targetting software is working again.") + else + SetScreenMsg(FontColour.FONT_MCOLOR_RED, "Whoever hacked the controls was more capable then we are - we cannot release the controls.") + end + else + SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "The software seems to work just fine, better not mess with it.") + end + end end -- Meduna SAM: get info from the pc and use the command console elseif ( sLuaactionid == ModSpecificActions.COMPUTER_MEDUNASAM_PC_1 ) then @@ -978,9 +1089,43 @@ function HandleInteractiveActionResult(sSectorX, sSectorY, bSectorZ, sGridNo, bL end elseif ( sLuaactionid == ModSpecificActions.COMPUTER_MEDUNASAM_COMMANDCONSOLE ) then if ( GetModderLUAFact(sLuaactionid) == ActionState.STATE_OK ) then + SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "This seems to be the console that controls the SAM.") - SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "You have no idea how this works.") - SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "You decide to not touch anything, you might break something.") + + samhackstatus = GetSamSiteHackStatus(sSectorX, sSectorY) + + ourhack = 100 - 2 * successpts + + if ( ourhack < 0 ) then + ourhack = 0 + end + + -- we can hack the SAM, decreasing its radius, or undo a previous hack + -- for simplicity, we will always hack a SAM if enemies are nearby - we are either infiltrating or figting the enemy in those cases + -- otherwise, we obviously control the SAM, so try to unhack it + if ( NumNonPlayerTeamInSector(sSectorX, sSectorY, Teams.ENEMY_TEAM) > 0 ) then + if ( ourhack >= samhackstatus ) then + SetScreenMsg(FontColour.FONT_MCOLOR_RED, "Someone already hacked this thing - and they broke it better than you could.") + else + SetSamSiteHackStatus(sSectorX, sSectorY, ourhack) + + SetScreenMsg(FontColour.FONT_MCOLOR_LTGREEN, "We've messed up the file system - they will need an expert to get this running again.") + end + else + if ( samhackstatus < 100 ) then + SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "You attempt to unhack it.") + + if ( ourhack <= samhackstatus ) then + SetSamSiteHackStatus(sSectorX, sSectorY, 100) + + SetScreenMsg(FontColour.FONT_MCOLOR_LTGREEN, "We are successful, the targetting software is working again.") + else + SetScreenMsg(FontColour.FONT_MCOLOR_RED, "Whoever hacked the controls was more capable then we are - we cannot release the controls.") + end + else + SetScreenMsg(FontColour.FONT_MCOLOR_DKWHITE, "The software seems to work just fine, better not mess with it.") + end + end end -- MEDUNA PALACE BUNKER -- entrance desktop contains a list of important people allied to the queen diff --git a/gamedir/Data-1.13/TableData/Map/InteractiveActions.xml b/gamedir/Data-1.13/TableData/Map/InteractiveActions.xml index fedb5b57b..c0f84d7e5 100644 --- a/gamedir/Data-1.13/TableData/Map/InteractiveActions.xml +++ b/gamedir/Data-1.13/TableData/Map/InteractiveActions.xml @@ -339,7 +339,7 @@ 11135 0 1 - 10 + 15 14 @@ -386,7 +386,7 @@ 10196 0 1 - 10 + 15 17 @@ -448,7 +448,7 @@ 15920 0 1 - 10 + 15 21 @@ -499,7 +499,7 @@ 11912 0 1 - 10 + 15 24 diff --git a/gamedir/Data-1.13/TableData/Map/SamSites.xml b/gamedir/Data-1.13/TableData/Map/SamSites.xml index 558906381..f9838c147 100644 --- a/gamedir/Data-1.13/TableData/Map/SamSites.xml +++ b/gamedir/Data-1.13/TableData/Map/SamSites.xml @@ -36,6 +36,8 @@ Fields index: There is air control table at the end on this file. The numbers indicate what sam site controls air space of sector. Zero (0) means neither of sams control this sector. +Each sector now takes a flagmask indicating the SAMs. So 1 is for SAM 1, 2 for SAM 2, 4 for SAM 3, 8 for SAM 4 and so on. +Add numbers to have mutliple SAMs covering a sector, so 3 means that both SAM 1 and 2 cover a sector. NOTE: Rows 0 and 17, and also columns 0 and 17 CANNOT BE USED. It is world borders. @@ -91,26 +93,50 @@ Others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