share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua
changeset 12942 ca23981ec219
parent 12941 ffbd31afed96
child 12943 3feab46234dd
equal deleted inserted replaced
12941:ffbd31afed96 12942:ca23981ec219
  1403 
  1403 
  1404 end
  1404 end
  1405 
  1405 
  1406 function onTimer(key)
  1406 function onTimer(key)
  1407 
  1407 
       
  1408 	-- Hacky workaround for object placer: Since this is based on the drill strike, it
       
  1409 	-- allows the 5 timer keys to be pressed, causing the announcer to show up
       
  1410 	-- This triggers code in 1 tick to send other message to mask the earlier one.
  1408 	checkForSpecialWeaponsIn = 1
  1411 	checkForSpecialWeaponsIn = 1
  1409 
  1412 
       
  1413 	if (curWep == amCMStructurePlacer) then
       
  1414 		-- Select structure directly in structure placer
       
  1415 		-- [Timer X] selects structures 1-5
       
  1416 		-- [Precise]+[Timer X] selects structures 6-10
       
  1417 
       
  1418 		local structureID = key
       
  1419 		local precise = band(GetGearMessage(CurrentHedgehog), gmPrecise) ~= 0
       
  1420 		if precise then
       
  1421 			structureID = structureID + 5
       
  1422 		end
       
  1423 		-- Check for valid pIndex
       
  1424 		if structureID <= #pMode then
       
  1425 			pIndex = structureID
       
  1426 			showModeMessage()
       
  1427 			updateCost()
       
  1428 		end
       
  1429 	elseif (curWep == amCMObjectPlacer) then
       
  1430 		-- [Timer X]: Set mine time 1-5
       
  1431 		if cat[cIndex] == "Mine Placement Mode" then
       
  1432 			local index = key + 1
       
  1433 			if key <= #pMode then
       
  1434 				pIndex = index
       
  1435 				showModeMessage()
       
  1436 				updateCost()
       
  1437 			end
       
  1438 		end
       
  1439 	end
       
  1440 
       
  1441 end
       
  1442 
       
  1443 function onSwitch()
       
  1444 	if (curWep == amCMObjectPlacer) then
       
  1445 		-- [Switch]: Set mine time to 0
       
  1446 		pIndex = 1
       
  1447 		showModeMessage()
       
  1448 		updateCost()
       
  1449 	end
  1410 end
  1450 end
  1411 
  1451 
  1412 function onLeft()
  1452 function onLeft()
  1413 
  1453 
  1414 	pIndex = pIndex - 1
  1454 	pIndex = pIndex - 1
  1601 	SetAmmoTexts(amCMStructurePlacer, loc("Structure Placer"), loc("Construction Mode tool"), loc("Build one of multiple different structures|to aid you in victory, at the cost of energy.") .. "| |" ..
  1641 	SetAmmoTexts(amCMStructurePlacer, loc("Structure Placer"), loc("Construction Mode tool"), loc("Build one of multiple different structures|to aid you in victory, at the cost of energy.") .. "| |" ..
  1602 	loc("Healing Station: Heals nearby hogs.")  .. "|" ..
  1642 	loc("Healing Station: Heals nearby hogs.")  .. "|" ..
  1603 	loc("Bio-Filter: Aggressively removes enemies.")  .. "|" ..
  1643 	loc("Bio-Filter: Aggressively removes enemies.")  .. "|" ..
  1604 	loc("Weapon Filter: Dematerializes all ammo|    carried by enemies entering it.")  .. "|" ..
  1644 	loc("Weapon Filter: Dematerializes all ammo|    carried by enemies entering it.")  .. "|" ..
  1605 	loc("Reflector Shield: Reflects enemy projectiles.")  .. "|" ..
  1645 	loc("Reflector Shield: Reflects enemy projectiles.")  .. "|" ..
  1606 	loc("Generator: Generates energy.")  .. "|" ..
       
  1607 	loc("Respawner: Resurrects dead hogs.")  .. "|" ..
  1646 	loc("Respawner: Resurrects dead hogs.")  .. "|" ..
  1608 	loc("Teleportation Node: Allows teleportation|    between other nodes.")  .. "|" ..
  1647 	loc("Teleportation Node: Allows teleportation|    between other nodes.")  .. "|" ..
       
  1648 	loc("Generator: Generates energy.")  .. "|" ..
  1609 	loc("Construction Station: Allows placement of|    girders, rubber, mines, sticky mines|    and barrels.")  .. "|" ..
  1649 	loc("Construction Station: Allows placement of|    girders, rubber, mines, sticky mines|    and barrels.")  .. "|" ..
  1610 	loc("Support Station: Allows placement of crates.") .. "| |" ..
  1650 	loc("Support Station: Allows placement of crates.") .. "| |" ..
  1611 
  1651 
  1612 	loc("Left/right: Choose structure type|Cursor: Build structure"))
  1652 	loc("Left/right: Choose structure type").."|"..
       
  1653 	loc("1-5, Precise + 1-4: Choose structure type").."|"..
       
  1654 	loc("Cursor: Build structure"))
  1613 
  1655 
  1614 	local txt_crateLimit = ""
  1656 	local txt_crateLimit = ""
  1615 	if conf_cratesPerRound ~= "inf" then
  1657 	if conf_cratesPerRound ~= "inf" then
  1616 		txt_crateLimit = string.format(loc("You may only place %d crates per round."), conf_cratesPerRound) .. "|"
  1658 		txt_crateLimit = string.format(loc("You may only place %d crates per round."), conf_cratesPerRound) .. "|"
  1617 	end
  1659 	end
  1620 		loc("This allows you to create a crate anywhere|within your clan's area of influence,|at the cost of energy.") .. "|" ..
  1662 		loc("This allows you to create a crate anywhere|within your clan's area of influence,|at the cost of energy.") .. "|" ..
  1621 		txt_crateLimit ..
  1663 		txt_crateLimit ..
  1622 		loc("Up/down: Choose crate type") .. "|" .. 
  1664 		loc("Up/down: Choose crate type") .. "|" .. 
  1623 		loc("Left/right: Choose crate contents") .. "|" ..
  1665 		loc("Left/right: Choose crate contents") .. "|" ..
  1624 		loc("|Cursor: Place crate"))
  1666 		loc("|Cursor: Place crate"))
  1625 	SetAmmoTexts(amCMObjectPlacer, loc("Object Placer"), loc("Construction Mode tool"), loc("This allows you to create and place mines,|sticky mines and barrels anywhere within your|clan's area of influence at the cost of energy.|Up/down: Choose object type|Left/right: Choose timer (for mines)|Cursor: Place object"))
  1667 	SetAmmoTexts(amCMObjectPlacer, loc("Object Placer"), loc("Construction Mode tool"),
       
  1668 		loc("This allows you to create and place mines,|sticky mines and barrels anywhere within your|clan's area of influence at the cost of energy.").."|"..
       
  1669 		loc("Up/down: Choose object type|1-5/Switch/Left/Right: Choose mine timer|Cursor: Place object")
       
  1670 	)
  1626 
  1671 
  1627 	SetAmmoDescriptionAppendix(amTeleport, loc("It only works in teleportation nodes of your own clan."))
  1672 	SetAmmoDescriptionAppendix(amTeleport, loc("It only works in teleportation nodes of your own clan."))
  1628 	
  1673 	
  1629 	sCirc = AddVisualGear(0,0,vgtCircle,0,true)
  1674 	sCirc = AddVisualGear(0,0,vgtCircle,0,true)
  1630 	SetVisualGearValues(sCirc, 0, 0, 100, 255, 1, 10, 0, 40, 3, 0x00000000)
  1675 	SetVisualGearValues(sCirc, 0, 0, 100, 255, 1, 10, 0, 40, 3, 0x00000000)