share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua
changeset 11724 9fea4e2dceaa
parent 11723 f699978eae19
child 11725 5cb2f245ee2f
equal deleted inserted replaced
11723:f699978eae19 11724:9fea4e2dceaa
   417 		frameID = 1
   417 		frameID = 1
   418 	elseif pType == loc("Teleportation Node") then
   418 	elseif pType == loc("Teleportation Node") then
   419 		table.insert(strucCircCol,0x0000FFFF)
   419 		table.insert(strucCircCol,0x0000FFFF)
   420 		table.insert(strucCircRadius,350)
   420 		table.insert(strucCircRadius,350)
   421 		frameID = 6
   421 		frameID = 6
   422 	elseif pType == loc("Core") then
       
   423 		table.insert(strucCircCol,0xFFFFFFFF)
       
   424 		table.insert(strucCircRadius,350)
       
   425 	elseif pType == loc("Generator") then
   422 	elseif pType == loc("Generator") then
   426 		table.insert(strucCircCol,0xFFFF00FF)
   423 		table.insert(strucCircCol,0xFFFF00FF)
   427 		table.insert(strucCircRadius,75)
   424 		table.insert(strucCircRadius,75)
   428 		setGearValue(tempG, "power", 0)
   425 		setGearValue(tempG, "power", 0)
   429 		frameID = 2
   426 		frameID = 2
   763 					end
   760 					end
   764 
   761 
   765 
   762 
   766 				end
   763 				end
   767 			end
   764 			end
   768 
       
   769 		-- doesn't do shit
       
   770 		elseif strucType[tempID] == loc("Core") then
       
   771 
       
   772 			if GetGearType(gear) == gtHedgehog then
       
   773 				if GetHogClan(gear) == strucClan[tempID] then
       
   774 
       
   775 				tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true)
       
   776 					g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
       
   777 					SetVisualGearValues(tempE, g1+20, g2, g3, g4, g5, g6, g7, g8, g9, GetClanColor(strucClan[tempID]) )
       
   778 
       
   779 					tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true)
       
   780 					g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
       
   781 					SetVisualGearValues(tempE, g1-20, g2, g3, g4, g5, g6, g7, g8, g9, GetClanColor(strucClan[tempID]) )
       
   782 
       
   783 				end
       
   784 			end
       
   785 
       
   786 		end
   765 		end
   787 
   766 
   788 	end
   767 	end
   789 
   768 
   790 end
   769 end
   830 			runOnGears(CheckProximity)
   809 			runOnGears(CheckProximity)
   831 		else -- only check prox on CurrentHedgehog
   810 		else -- only check prox on CurrentHedgehog
   832 			CheckProximity(CurrentHedgehog)
   811 			CheckProximity(CurrentHedgehog)
   833 		end
   812 		end
   834 
   813 
   835 		if strucType[i] == loc("Core") then
   814 		if strucType[i] == loc("Reflector Shield") then
   836 			tempE = AddVisualGear(GetX(strucGear[i]), GetY(strucGear[i]), vgtSmoke, 0, true)
       
   837 			g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
       
   838 			SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, GetClanColor(strucClan[i]) )
       
   839 		elseif strucType[i] == loc("Reflector Shield") then
       
   840 
   815 
   841 		elseif strucType[i] == loc("Generator") then
   816 		elseif strucType[i] == loc("Generator") then
   842 
   817 
   843 			for z = 0, ClansCount-1 do
   818 			for z = 0, ClansCount-1 do
   844 				if z == strucClan[i] then
   819 				if z == strucClan[i] then
  1005 				--{amResurrector, 	"amResurrector",	0, loc("Resurrector"), 		8*placeholder},
   980 				--{amResurrector, 	"amResurrector",	0, loc("Resurrector"), 		8*placeholder},
  1006 				--{amTardis, 			"amTardis",			0, loc("Time Box"), 			2*placeholder},
   981 				--{amTardis, 			"amTardis",			0, loc("Time Box"), 			2*placeholder},
  1007 
   982 
  1008 				--{amSwitch,			"amSwitch",			0, loc("Switch Hog"), 		4*placeholder}
   983 				--{amSwitch,			"amSwitch",			0, loc("Switch Hog"), 		4*placeholder}
  1009 				}
   984 				}
  1010 
       
  1011 ----------------------------
       
  1012 -- hog and map editting junk
       
  1013 ----------------------------
       
  1014 
       
  1015  local reducedSpriteIDArray = {
       
  1016   sprBigDigit, sprKowtow, sprBee, sprExplosion50, sprGirder
       
  1017   }
       
  1018 
       
  1019   local reducedSpriteTextArray = {
       
  1020   "sprBigDigit", "sprKowtow", "sprBee", "sprExplosion50", "sprGirder"
       
  1021   }
       
  1022 
   985 
  1023 ----------------------------
   986 ----------------------------
  1024 -- placement shite
   987 -- placement shite
  1025 ----------------------------
   988 ----------------------------
  1026 
   989 
  1133 			PlaceGirder(x, y, CGR)
  1096 			PlaceGirder(x, y, CGR)
  1134 			placedSpec[placedCount] = CGR
  1097 			placedSpec[placedCount] = CGR
  1135 		elseif cat[cIndex] == "Rubber Placement Mode" then
  1098 		elseif cat[cIndex] == "Rubber Placement Mode" then
  1136 			PlaceSprite(x,y, sprAmRubber, CGR, nil, nil, nil, nil, lfBouncy)
  1099 			PlaceSprite(x,y, sprAmRubber, CGR, nil, nil, nil, nil, lfBouncy)
  1137 			placedSpec[placedCount] = CGR
  1100 			placedSpec[placedCount] = CGR
  1138 		elseif cat[cIndex] == "Target Placement Mode" then
       
  1139 			gear = AddGear(x, y, gtTarget, 0, 0, 0, 0)
       
  1140 		elseif cat[cIndex] == "Cleaver Placement Mode" then
       
  1141 			gear = AddGear(x, y, gtKnife, 0, 0, 0, 0)
       
  1142 		elseif cat[cIndex] == "Health Crate Placement Mode" then
  1101 		elseif cat[cIndex] == "Health Crate Placement Mode" then
  1143 			gear = SpawnHealthCrate(x,y)
  1102 			gear = SpawnHealthCrate(x,y)
  1144 			SetHealth(gear, pMode[pIndex])
  1103 			SetHealth(gear, pMode[pIndex])
  1145 			setGearValue(gear,"caseType","med")
  1104 			setGearValue(gear,"caseType","med")
  1146 			clanCratesSpawned[GetHogClan(CurrentHedgehog)] = clanCratesSpawned[GetHogClan(CurrentHedgehog)] +1
  1105 			clanCratesSpawned[GetHogClan(CurrentHedgehog)] = clanCratesSpawned[GetHogClan(CurrentHedgehog)] +1
  1165 		elseif cat[cIndex] == "Mine Placement Mode" then
  1124 		elseif cat[cIndex] == "Mine Placement Mode" then
  1166 			gear = AddGear(x, y, gtMine, 0, 0, 0, 0)
  1125 			gear = AddGear(x, y, gtMine, 0, 0, 0, 0)
  1167 			SetTimer(gear, pMode[pIndex])
  1126 			SetTimer(gear, pMode[pIndex])
  1168 		elseif cat[cIndex] == "Sticky Mine Placement Mode" then
  1127 		elseif cat[cIndex] == "Sticky Mine Placement Mode" then
  1169 			gear = AddGear(x, y, gtSMine, 0, 0, 0, 0)
  1128 			gear = AddGear(x, y, gtSMine, 0, 0, 0, 0)
  1170 		elseif cat[cIndex] == "Advanced Repositioning Mode" then
       
  1171 
       
  1172 			if pMode[pIndex] == "Selection Mode" then
       
  1173 				closestDist = 999999999
       
  1174 				closestGear = nil -- just in case
       
  1175 				sGear = nil
       
  1176 				runOnGears(SelectGear)
       
  1177 				sGear = closestGear
       
  1178 				closestGear = nil
       
  1179 			elseif pMode[pIndex] == "Placement Mode" then
       
  1180 				if sGear ~= nil then
       
  1181 					SetGearPosition(sGear, x, y)
       
  1182 				end
       
  1183 			end
       
  1184 
       
  1185 		elseif cat[cIndex] == "Tagging Mode" then
       
  1186 
       
  1187 			closestDist = 999999999
       
  1188 			closestGear = nil
       
  1189 			sGear = nil
       
  1190 			runOnGears(SelectGear)
       
  1191 
       
  1192 
       
  1193 			if closestGear ~= nil then
       
  1194 
       
  1195 				if getGearValue(closestGear,"tag") == nil then
       
  1196 
       
  1197 					--if there is no tag, add a victory/failure tag and circle
       
  1198 					setGearValue(closestGear, "tCirc",AddVisualGear(0,0,vgtCircle,0,true))
       
  1199 
       
  1200 					if pMode[pIndex] == "Tag Victory Mode" then
       
  1201 						setGearValue(closestGear, "tag","victory")
       
  1202 						SetVisualGearValues(getGearValue(closestGear,"tCirc"), 0, 0, 100, 255, 1, 10, 0, 40, 3, 0xff0000ff)
       
  1203 					elseif pMode[pIndex] == "Tag Failure Mode" then
       
  1204 						setGearValue(closestGear, "tag","failure")
       
  1205 						SetVisualGearValues(getGearValue(closestGear,"tCirc"), 0, 0, 100, 255, 1, 10, 0, 40, 3, 0x0000ffff)
       
  1206 					end
       
  1207 
       
  1208 
       
  1209 				else
       
  1210 					-- remove tag and delete circ
       
  1211 					setGearValue(closestGear, "tag", nil)
       
  1212 					DeleteVisualGear(getGearValue(closestGear,"tCirc"))
       
  1213 					setGearValue(closestGear, "tCirc", nil)
       
  1214 				end
       
  1215 
       
  1216 			end
       
  1217 
       
  1218 
       
  1219 		elseif cat[cIndex] == "Sprite Testing Mode" then
       
  1220 
       
  1221 			frameID = 1
       
  1222 			visualSprite = reducedSpriteIDArray[pIndex]
       
  1223 			tempE = AddVisualGear(x, y, vgtStraightShot, 0, true)
       
  1224 			g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
       
  1225 			SetVisualGearValues(tempE, g1, g2, 0, 0, g5, frameID, g7, visualSprite, g9, g10 )
       
  1226 	--sprHorizonLong crashes game, so does skyL, as does flake
       
  1227 
       
  1228 		-- reduced list of cool sprites
       
  1229 		-- sprBigDigit, sprKnife, sprFrozenHog, sprKowtow, sprBee, sprExplosion50, sprPiano, sprChunk, sprHHTelepMask, sprSeduction, sprSwitch, sprGirder,
       
  1230 		--sprAMAmmos, sprAMSlotKeys, sprTurnsLeft, sprExplosivesRoll + maybe some others like the health case, arrows, etc
       
  1231 
       
  1232 		elseif cat[cIndex] == "Sprite Placement Mode" then
       
  1233 
       
  1234 			PlaceSprite(x,y, reducedSpriteIDArray[pIndex], 1, nil, nil, nil, nil, landType)
       
  1235 			placedSpec[placedCount] = reducedSpriteTextArray[pIndex]
       
  1236 			placedSuperSpec[placedCount] = landType
       
  1237 
       
  1238 			if landType == lfIce then
       
  1239 				placedSuperSpec[placedCount] = "lfIce"
       
  1240 			elseif landType == lfIndestructible then
       
  1241 				placedSuperSpec[placedCount] = "lfIndestructible"
       
  1242 			elseif landType == lfBouncy then
       
  1243 				placedSuperSpec[placedCount] = "lfBouncy"
       
  1244 			else
       
  1245 				placedSuperSpec[placedCount] = "lfNormal"
       
  1246 			end
       
  1247 
  1129 
  1248 		elseif cat[cIndex] == "Structure Placement Mode" then
  1130 		elseif cat[cIndex] == "Structure Placement Mode" then
  1249 
  1131 
  1250 			AddStruc(x,y, pMode[pIndex],GetHogClan(CurrentHedgehog))
  1132 			AddStruc(x,y, pMode[pIndex],GetHogClan(CurrentHedgehog))
  1251 
  1133 
  1280 		pMode = {loc("Girder")}
  1162 		pMode = {loc("Girder")}
  1281 	elseif cat[cIndex] == "Rubber Placement Mode" then
  1163 	elseif cat[cIndex] == "Rubber Placement Mode" then
  1282 		pIndex = CGR
  1164 		pIndex = CGR
  1283 		pMode = {loc("Rubber")}
  1165 		pMode = {loc("Rubber")}
  1284 		placedExpense = 3
  1166 		placedExpense = 3
  1285 	elseif cat[cIndex] == "Target Placement Mode" then
       
  1286 		pMode = {loc("Target")}
       
  1287 	elseif cat[cIndex] == "Cleaver Placement Mode" then
       
  1288 		pMode = {loc("Cleaver")}
       
  1289 	elseif cat[cIndex] == "Barrel Placement Mode" then
  1167 	elseif cat[cIndex] == "Barrel Placement Mode" then
  1290 		pMode = {60}
  1168 		pMode = {60}
  1291 		placedExpense = 10
  1169 		placedExpense = 10
  1292 	elseif cat[cIndex] == "Health Crate Placement Mode" then
  1170 	elseif cat[cIndex] == "Health Crate Placement Mode" then
  1293 		pMode = {25}
  1171 		pMode = {25}
  1306 		pMode = {0,1000,2000,3000,4000,5000}
  1184 		pMode = {0,1000,2000,3000,4000,5000}
  1307 		placedExpense = 15
  1185 		placedExpense = 15
  1308 	elseif cat[cIndex] == "Sticky Mine Placement Mode" then
  1186 	elseif cat[cIndex] == "Sticky Mine Placement Mode" then
  1309 		pMode = {loc("Sticky Mine")}
  1187 		pMode = {loc("Sticky Mine")}
  1310 		placedExpense = 20
  1188 		placedExpense = 20
  1311 	elseif cat[cIndex] == "Advanced Repositioning Mode" then
       
  1312 		pMode = {"Selection Mode","Placement Mode"}
       
  1313 	elseif cat[cIndex] == "Tagging Mode" then
       
  1314 		pMode = {"Tag Victory Mode","Tag Failure Mode"}
       
  1315 	elseif cat[cIndex] == "Sprite Testing Mode" or cat[cIndex] == "Sprite Placement Mode" then
       
  1316 		for i = 1, #reducedSpriteTextArray do
       
  1317 			pMode[i] = reducedSpriteTextArray[i]
       
  1318 		end
       
  1319 		placedExpense = 100
       
  1320 	elseif cat[cIndex] == "Structure Placement Mode" then
  1189 	elseif cat[cIndex] == "Structure Placement Mode" then
  1321 		pMode = {loc("Healing Station"), loc("Bio-Filter"), loc("Weapon Filter"), loc("Reflector Shield"), loc("Respawner"),loc("Teleportation Node"),loc("Generator"),loc("Construction Station"),loc("Support Station")}
  1190 		pMode = {loc("Healing Station"), loc("Bio-Filter"), loc("Weapon Filter"), loc("Reflector Shield"), loc("Respawner"),loc("Teleportation Node"),loc("Generator"),loc("Construction Station"),loc("Support Station")}
  1322 	end
  1191 	end
  1323 
  1192 
  1324 
  1193 
  1423 				wallsVisible = false
  1292 				wallsVisible = false
  1424 			end
  1293 			end
  1425 
  1294 
  1426 		end
  1295 		end
  1427 
  1296 
  1428 	end
       
  1429 
       
  1430 	--update selected gear display
       
  1431 	if (cat[cIndex] == "Advanced Repositioning Mode") and (sGear ~= nil) then
       
  1432 		SetVisualGearValues(sCirc, GetX(sGear), GetY(sGear), 100, 255, 1, 10, 0, 300, 3, 0xff00ffff)
       
  1433 	elseif (cat[cIndex] == "Tagging Mode") then
       
  1434 		if (sGear ~= nil) or (closestGear ~= nil) then
       
  1435 			SetVisualGearValues(sCirc, GetX(sGear), GetY(sGear), 0, 1, 1, 10, 0, 1, 1, 0x00000000)
       
  1436 			closestGear = nil
       
  1437 			sGear = nil
       
  1438 		end
       
  1439 	end
  1297 	end
  1440 
  1298 
  1441 	-- some kind of target detected, tell me your story
  1299 	-- some kind of target detected, tell me your story
  1442 	if cGear ~= nil then
  1300 	if cGear ~= nil then
  1443 
  1301 
  1487 		placedExpense = 50
  1345 		placedExpense = 50
  1488 	elseif pMode[pIndex] == loc("Generator") then
  1346 	elseif pMode[pIndex] == loc("Generator") then
  1489 			placedExpense = 300
  1347 			placedExpense = 300
  1490 	elseif pMode[pIndex] == loc("Reflector Shield") then
  1348 	elseif pMode[pIndex] == loc("Reflector Shield") then
  1491 			placedExpense = 200
  1349 			placedExpense = 200
  1492 	elseif pMode[pIndex] == loc("Core") then
       
  1493 		placedExpense = 1
       
  1494 	elseif cat[cIndex] == "Weapon Crate Placement Mode" then
  1350 	elseif cat[cIndex] == "Weapon Crate Placement Mode" then
  1495 		placedExpense = atkArray[pIndex][5]
  1351 		placedExpense = atkArray[pIndex][5]
  1496 	elseif cat[cIndex] == "Utility Crate Placement Mode" then
  1352 	elseif cat[cIndex] == "Utility Crate Placement Mode" then
  1497 		placedExpense = utilArray[pIndex][5]
  1353 		placedExpense = utilArray[pIndex][5]
  1498 	end
  1354 	end