# Mine Warfare Mod
pUnit = g_pSelectedUnit
iUnitType = pUnit.getUnitType()
iUnitOwner = pUnit.getOwner( )
pUnitOwner = gc.getPlayer(pUnit.getOwner( ))
iPlotX = pUnit.getX()
iPlotY = pUnit.getY()
pPlot = CyMap().plot(iPlotX, iPlotY)
iUnitNavalMine = gc.getInfoTypeForString("UNIT_NAVAL_MINE")
iUnitNavalMineField = gc.getInfoTypeForString("UNIT_NAVAL_MINE_FIELD")
iUnitNuclearNavalMine = gc.getInfoTypeForString("UNIT_NUCLEAR_NAVAL_MINE")
iUnitLandMine = gc.getInfoTypeForString("UNIT_LAND_MINE")
iUnitLandMineField = gc.getInfoTypeForString("UNIT_LAND_MINE_FIELD")
iUnitNuclearLandMine = gc.getInfoTypeForString("UNIT_NUCLEAR_LAND_MINE")
iUnitNavalMineSweeper = gc.getInfoTypeForString("UNIT_NAVAL_MINE_SWEEPER")
iUnitLandMineSweeper = gc.getInfoTypeForString("UNIT_LAND_MINE_SWEEPER")
MineList = [
iUnitNavalMine,
iUnitNavalMineField,
iUnitNuclearNavalMine,
iUnitLandMine,
iUnitLandMineField,
iUnitNuclearLandMine,
]
SweeperList = [
iUnitNavalMineSweeper,
iUnitLandMineSweeper
]
NuclearMineList = [
iUnitNuclearNavalMine,
iUnitNuclearLandMine
]
if pUnitOwner.isTurnActive( ):
# ##### Arming Switch for ALL unarmed Mines - Button ######
# Is this a Mine?
if (iUnitType in MineList):
# Is this Mine unarmed?
if not MineWarfare.isMineImmobile(pUnit):
# Can't arm a mine in a city
if not pPlot.isCity():
screen.appendMultiListButton( "BottomButtonContainer", ArtFileMgr.getInterfaceArtInfo("INTERFACE_ARMING_SWITCH").getPath(), 0, WidgetTypes.WIDGET_GENERAL, 776, 776, False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1
return
# ##### Naval Mine Sweeper Unit Button ######
if (iUnitType in SweeperList):
if not pPlot.isCity():
if MineWarfare.hasEnemyMine(pPlot, iUnitOwner):
if pPlot.getPlotType() == PlotTypes.PLOT_OCEAN:
screen.appendMultiListButton( "BottomButtonContainer", ArtFileMgr.getInterfaceArtInfo("INTERFACE_GREEN_RADAR_SCREEN").getPath(), 0, WidgetTypes.WIDGET_GENERAL, 777, 777, False )
else:
screen.appendMultiListButton( "BottomButtonContainer", ArtFileMgr.getInterfaceArtInfo("INTERFACE_RED_RADAR_SCREEN").getPath(), 0, WidgetTypes.WIDGET_GENERAL, 778, 778, False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1
return
if (iUnitType in NuclearMineList):
# Is this Mine armed?
if MineWarfare.isMineImmobile(pUnit):
# ##### Nuclear Mine Detonation Button ######
if not pPlot.isCity():
screen.appendMultiListButton( "BottomButtonContainer", ArtFileMgr.getInterfaceArtInfo("INTERFACE_MUSHROOM_CLOUD").getPath(), 0, WidgetTypes.WIDGET_GENERAL, 779, 779, False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1
return
# End Mine Warfare Mod