Skip to content

Commit

Permalink
Merge branch 'release/v0.8.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
jlfarris91 committed Aug 25, 2022
2 parents 30c5c5a + 08e5a80 commit 908d0d3
Show file tree
Hide file tree
Showing 18 changed files with 185 additions and 109 deletions.
2 changes: 1 addition & 1 deletion _build/dependencies/WurstCore
2 changes: 1 addition & 1 deletion _build/dependencies/wurstStdlib2
4 changes: 2 additions & 2 deletions imports/TLSFrames.fdf
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ Frame "FRAME" "SurvivorJobFrame" {

Frame "TEXT" "UnassignJobText" INHERITS "EscMenuLabelTextTemplate" {
UseActiveContext,
Width 0.035,
Width 0.045,
Height 0.008,
SetPoint BOTTOMLEFT, "SurvivorJobFrame", TOPLEFT, 0.0, 0.01
SetPoint BOTTOM, "SurvivorJobFrame", TOP, 0.0, 0.01
FrameFont "MasterFont", 0.004,"",
FontJustificationH JUSTIFYCENTER,
}
Expand Down
4 changes: 2 additions & 2 deletions imports/war3map.wts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ The Last Stand

STRING 1326
{
Build more Shelters to continue unit production.,Build more Burrows to continue unit production.,Summon more Ziggurats to continue unit production.,Create more Moon Wells to continue unit production.
Upgrade your HQ Tent to be able to build more Shelters.,Build more Burrows to continue unit production.,Summon more Ziggurats to continue unit production.,Create more Moon Wells to continue unit production.
}

STRING 1327
Expand Down Expand Up @@ -1044,5 +1044,5 @@ Wall Low (Decoration) (No Pitch)

STRING 3829
{
The number of Survivors your camp has room for over the total amount that your camp can sustain. Each Shelter provides room for 1 Survivor. Survivors will automatically spawn as long as you have more Shelters than Survivors alive.
The number of Survivors your camp has room for over the total amount that your camp can sustain. Each Shelter provides room for 1/2/3 Survivor(s). Survivors will automatically spawn as long as you have more Shelters than Survivors alive.
}
4 changes: 2 additions & 2 deletions wurst/Compile/Items/JobItems/Item_Dagger.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public JobItemDefinition g_daggerDefinition
..setTooltipExtended(builder.getTooltipExtended())
..setInterfaceIcon("ReplaceableTextures\\CommandButtons\\BTNSacrificialDagger.blp")
..setGoldCost(0)
..setLumberCost(600)
..setLumberCost(0)
..setStockInitial(1)
..setStockMaximum(3)
..setStockStartDelay(0)
Expand All @@ -49,7 +49,7 @@ public JobItemDefinition g_daggerDefinition
..setTooltipExtended(g_daggerDefinition.getTooltipExtended())
..setDescription(g_daggerDefinition.getDescription())
..setGoldCost(0)
..setLumberCost(600)
..setLumberCost(0)
..setIconGameInterface(g_daggerDefinition.getInterfaceIcon())
..setBuildTime(15)
..setButtonPositionX(0)
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions wurst/Game/GameSetup.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public class GameSetup
// --------------------------------------------------------------------------
private function showDifficultySelectionDialogToPlayer(player _player)

let playerSaveData = PlayerSaveData.getPlayerSaveData(_player) castTo PlayerSaveData_v801
let playerSaveData = PlayerSaveDataVersioned.getPlayerSaveData(_player)
if (playerSaveData == null)
Log.debug("GameSetup", "showDifficultySelectionDialogToPlayer", _player.getId().toString(), " Player save data is null")
return
Expand Down Expand Up @@ -197,7 +197,7 @@ public class GameSetup
let vm = difficultySelectDialog.getDataContext()
let selectedDifficulty = vm.getSelectedDifficulty()

let playerSaveData = PlayerSaveData.getPlayerSaveData(_player) castTo PlayerSaveData_v801
let playerSaveData = PlayerSaveDataVersioned.getPlayerSaveData(_player)

if (playerSaveData != null)
playerSaveData.selectedDifficulty = selectedDifficulty
Expand Down
9 changes: 9 additions & 0 deletions wurst/Lootables/LootOperationComponent.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ constant int PROGRESS_BAR_LENGTH = 20
constant colorA PROGRESS_BAR_FOREGROUND = colorA(0, 170, 0, 255)
constant colorA PROGRESS_BAR_BACKGROUND = colorA(0, 64, 0, 255)
constant real PROGRESS_BAR_UPDATE_PERIOD = 0.1
constant real LOOTER_STANDING_POS_THRESHOLD_SQ = 64.0 * 64.0

LinkedList<LootOperationComponent> g_activeOperations
HashMap<unit, LootOperationComponent> g_looterToOperationMap = new HashMap<unit, LootOperationComponent>()
Expand All @@ -46,6 +47,7 @@ public class LootOperationComponent extends RealtimeUnitComponent
private int m_secondsElapsed
private real m_manaCost
private bool m_isRunning
private vec2 m_looterPos

// --------------------------------------------------------------------------
construct(IUnitMetadata owner)
Expand Down Expand Up @@ -106,6 +108,11 @@ public class LootOperationComponent extends RealtimeUnitComponent

if (getIsRunning() == false)
return

// Catch any edge-case order that would cause the looter to move while still looting
if (m_lootingUnit.getPos().distanceToSq(m_looterPos) > LOOTER_STANDING_POS_THRESHOLD_SQ)
cancel()
return

let percentage01 = parameterize01(m_duration, 0.0, m_timer.getRemaining())
m_progress.report(percentage01)
Expand Down Expand Up @@ -134,6 +141,8 @@ public class LootOperationComponent extends RealtimeUnitComponent
let lootingPlayer = looter.getOwner()
let cameraPos = getOwnerUnit().getPos()

m_looterPos = looter.getPos()

// Avoid implicit capture of 'this' by caching the result of m_lootableUnit
let lootableUnitCached = getOwnerUnit()
m_timer.doManual(duration, true, () -> onOperationFinished(lootableUnitCached))
Expand Down
4 changes: 2 additions & 2 deletions wurst/Players/HumanPlayerComponent.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,12 @@ public class HumanPlayerComponent extends PlayerComponent

// --------------------------------------------------------------------------
function load(IPlayerSaveData saveData)
let saveDataVersioned = saveData castTo PlayerSaveData_v801
let saveDataVersioned = saveData castTo PlayerSaveData_v800
setCameraDistance(saveDataVersioned.cameraDistance)

// --------------------------------------------------------------------------
function save(IPlayerSaveData saveData)
let saveDataVersioned = saveData castTo PlayerSaveData_v801
let saveDataVersioned = saveData castTo PlayerSaveData_v800
saveDataVersioned.cameraDistance = getCameraDistance()

// --------------------------------------------------------------------------
Expand Down
26 changes: 25 additions & 1 deletion wurst/Players/PlayerCommands.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import ItemType
// import VoteKick
import PlayerUtility
import Notifications
import PlayerSaveData
import Tips

constant string COMMAND_BASE = "base"
constant string COMMAND_BASES = "bases"
Expand All @@ -27,6 +29,7 @@ constant string COMMAND_GIVELUMB = "givelumber"
constant string COMMAND_GIVELUMB_ALIAS = "givel"
constant string COMMAND_GIVELUMB_ALIAS2 = "gl"
constant string COMMAND_SAVE = "save"
constant string COMMAND_TIPS = "tips"
// constant string COMMAND_VOTEKICK = "votekick"

public quest g_playerCommandsQuest
Expand Down Expand Up @@ -163,6 +166,23 @@ function giveLumber()
function savePlayerData()
getChatCommandPlayer().getHumanPlayerComponentRequired().save(true)

// ============================================================================
function toggleTips()

let commandPlayer = getChatCommandPlayer()

let saveData = PlayerSaveDataVersioned.getPlayerSaveData(commandPlayer)
if (saveData == null)
Log.error("Player save data is null")
return

saveData.showTipsOnInterval = not saveData.showTipsOnInterval
Tips.showTipsForPlayer(commandPlayer, saveData.showTipsOnInterval)

chatCommandPrintToPlayer(commandPlayer, "Turned tips " + (saveData.showTipsOnInterval ? "on" : "off"))

PlayerSaveData.save(commandPlayer, false)

// // ============================================================================
// function startVoteKick()
// let command = getChatCommand()
Expand All @@ -184,8 +204,9 @@ function savePlayerData()
function setupPlayerCommandsQuest()
g_playerCommandsQuest = CreateQuest()
QuestSetIconPath(g_playerCommandsQuest, "ReplaceableTextures\\WorldEditUI\\DoodadPlaceholder.blp")
QuestSetTitle(g_playerCommandsQuest, "Player Commands")
QuestSetTitle(g_playerCommandsQuest, "Chat Commands")
QuestSetRequired(g_playerCommandsQuest, false)
QuestSetDescription(g_playerCommandsQuest, "A list of chat commands and how to use them")

// ============================================================================
function registerDebugCommands()
Expand Down Expand Up @@ -229,6 +250,9 @@ function registerDebugCommands()
g_playerChatCommandHandler.registerCommandDefinition(COMMAND_SAVE, function savePlayerData)
..setDescription("Saves data for the player to a file on the disk")

g_playerChatCommandHandler.registerCommandDefinition(COMMAND_TIPS, function toggleTips)
..setDescription("Toggles the displaying of tips every 30 seconds")

// g_playerChatCommandHandler.registerCommandDefinition(COMMAND_VOTEKICK, function startVoteKick)
// ..setDescription("Start a vote to kick a player")
// ..addStringArgument("PLAYER_NAME_PARTIAL_OR_ID", false)
Expand Down
5 changes: 4 additions & 1 deletion wurst/Players/PlayerSetup.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import PlayerProperties
import Difficulties
import PlayerSaveData
import HelpMenu
import Tips

PlayerSetup array g_playerSetups

Expand Down Expand Up @@ -51,14 +52,16 @@ public class PlayerSetup
if (itemFindQualityProp != null)
itemFindQualityProp.setBase(DifficultyScaling.getItemQualityScalar01(m_difficulty))

let playerSaveData = PlayerSaveData.getPlayerSaveData(_player) castTo PlayerSaveData_v801
let playerSaveData = PlayerSaveDataVersioned.getPlayerSaveData(_player)
if (playerSaveData == null)
Log.error("Player save data is null")
return

if (playerSaveData.showTipsOnStartup)
HelpMenu.show(_player)

Tips.showTipsForPlayer(_player, playerSaveData.showTipsOnInterval)

// --------------------------------------------------------------------------
function setHeroAbilityId(HeroAbilityGroup heroAbilityGroup, int abilId)
let existingGroupAbilId = getHeroAbilityId(heroAbilityGroup)
Expand Down
20 changes: 17 additions & 3 deletions wurst/Quests/Quests.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ function setupQuests()
QuestSetIconPath(discordQuest, "ReplaceableTextures\\CommandButtons\\BTNDiscord.tga")
QuestSetTitle(discordQuest, "Discord")
QuestSetRequired(discordQuest, false)
let discordQuestItem = QuestCreateItem(discordQuest)
QuestItemSetDescription(discordQuestItem, "|nJoin the Last Stand Discord server for the latest updates|n|n|cFFFFCC00{0}|r".format(DISCORD_LINK))
QuestSetDescription(discordQuest, "Displays a link to the Last Stand Discord server.")
QuestItemSetDescription(QuestCreateItem(discordQuest), "|nJoin the Last Stand Discord server for the latest updates|n|n|cFFFFCC00{0}|r".format(DISCORD_LINK))

let survivorQuest = CreateQuest()
QuestSetIconPath(survivorQuest, Icons.bTNVillagerMan)
QuestSetTitle(survivorQuest, "Survivor (Jobless)")
QuestSetRequired(survivorQuest, true)
QuestSetDescription(survivorQuest, "A description of a Survivor without an assigned job")
QuestItemSetDescription(QuestCreateItem(survivorQuest), "The basic worker unit.")
QuestItemSetDescription(QuestCreateItem(survivorQuest), "Give the Survivor a |cFFFFCC00Job Item|r to assign them a job.")
QuestItemSetDescription(QuestCreateItem(survivorQuest), "Builds basic camp structures")
Expand All @@ -26,6 +27,7 @@ function setupQuests()
QuestSetIconPath(builderQuest, Icons.bTNPeasant)
QuestSetTitle(builderQuest, "Survivor - |cFFFFCC00Builder|r")
QuestSetRequired(builderQuest, true)
QuestSetDescription(builderQuest, "A description of the Builder survivor job")
QuestItemSetDescription(QuestCreateItem(builderQuest), "The Builder can build more advanced structures for your camp.")
QuestItemSetDescription(QuestCreateItem(builderQuest), "Give a Survivor the |cFFFFCC00Builders Tools|r item to assign them the Builder job.")
QuestItemSetDescription(QuestCreateItem(builderQuest), "Build the |cFFFFCC00Builders Tools|r item in the |cFFFFCC00Workbench|r.")
Expand All @@ -36,6 +38,7 @@ function setupQuests()
QuestSetIconPath(militiaQuest, Icons.bTNMilitia)
QuestSetTitle(militiaQuest, "Survivor - |cFFFFCC00Militia|r")
QuestSetRequired(militiaQuest, true)
QuestSetDescription(militiaQuest, "A description of the Militia survivor job")
QuestItemSetDescription(QuestCreateItem(militiaQuest), "The Militia is a hybrid unit that deals extra damage to non-elites.")
QuestItemSetDescription(QuestCreateItem(militiaQuest), "Give a Survivor the |cFFFFCC00Rusty Sword|r item to assign them the Militia job.")
QuestItemSetDescription(QuestCreateItem(militiaQuest), "Build the |cFFFFCC00Rusty Sword|r item in the |cFFFFCC00Armory|r.")
Expand All @@ -49,6 +52,7 @@ function setupQuests()
QuestSetIconPath(spearmanQuest, "ReplaceableTextures\\CommandButtons\\BTNBrigand.blp")
QuestSetTitle(spearmanQuest, "Survivor - |cFFFFCC00Spearman|r")
QuestSetRequired(spearmanQuest, true)
QuestSetDescription(spearmanQuest, "A description of the Spearman survivor job")
QuestItemSetDescription(QuestCreateItem(spearmanQuest), "The Spearman is a ranged unit that deals extra damage to elites and air.")
QuestItemSetDescription(QuestCreateItem(spearmanQuest), "Give a Survivor the |cFFFFCC00Spears|r item to assign them the Spearman job.")
QuestItemSetDescription(QuestCreateItem(spearmanQuest), "Build the |cFFFFCC00Spears|r item in the |cFFFFCC00Spearman's Tent|r.")
Expand All @@ -60,6 +64,7 @@ function setupQuests()
QuestSetIconPath(marksmanQuest, Icons.bTNRifleman)
QuestSetTitle(marksmanQuest, "Survivor - |cFFFFCC00Marksman|r")
QuestSetRequired(marksmanQuest, true)
QuestSetDescription(marksmanQuest, "A description of the Marksman survivor job")
QuestItemSetDescription(QuestCreateItem(marksmanQuest), "The Marksman is a ranged unit that deals extra damage to elites and bosses.")
QuestItemSetDescription(QuestCreateItem(marksmanQuest), "Give a Survivor the |cFFFFCC00Hunting Rifle|r item to assign them the Marksman job.")
QuestItemSetDescription(QuestCreateItem(marksmanQuest), "Build the |cFFFFCC00Hunting Rifle|r item in the |cFFFFCC00Armory|r.")
Expand All @@ -72,9 +77,18 @@ function setupQuests()
QuestSetIconPath(priestQuest, Icons.bTNPriest)
QuestSetTitle(priestQuest, "Survivor - |cFFFFCC00Priest|r")
QuestSetRequired(priestQuest, true)
QuestSetDescription(priestQuest, "A description of the Priest survivor job")
QuestItemSetDescription(QuestCreateItem(priestQuest), "The Priest can heal friendly units.")
QuestItemSetDescription(QuestCreateItem(priestQuest), "Give a Survivor the |cFFFFCC00Holy Book|r item to assign them the Priest job.")
QuestItemSetDescription(QuestCreateItem(marksmanQuest), "Build the |cFFFFCC00Holy Book|r item in the |cFFFFCC00Chapel|r.")
QuestItemSetDescription(QuestCreateItem(priestQuest), "Build the |cFFFFCC00Holy Book|r item in the |cFFFFCC00Chapel|r.")

let acolyteQuest = CreateQuest()
QuestSetIconPath(acolyteQuest, Icons.bTNAcolyte)
QuestSetTitle(acolyteQuest, "Survivor - |cFFFFCC00Acolyte|r")
QuestSetRequired(acolyteQuest, true)
QuestSetDescription(acolyteQuest, "A description of the Acolyte survivor job")
QuestItemSetDescription(QuestCreateItem(acolyteQuest), "The Acolyte can build an Altar to revive dead heroes.")
QuestItemSetDescription(QuestCreateItem(acolyteQuest), "Give a Survivor the |cFFFFCC00Ceremonial Dagger|r item to assign them the Acolyte job.")

// let engineerQuest = CreateQuest()
// QuestSetIconPath(engineerQuest, Icons.bTNBloodElfPeasant)
Expand Down
6 changes: 3 additions & 3 deletions wurst/Survivors/BuilderBuildMenus.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class BuildingPageManager
decrementPageIndex()
setHighlightVisible(false)

let playerSaveData = (PlayerSaveData.getPlayerSaveData(m_player) castTo PlayerSaveData_v801)
let playerSaveData = PlayerSaveDataVersioned.getPlayerSaveData(m_player)
if (playerSaveData == null)
Log.debug("BBM", "onPrevPageButtonClicked", m_player.getId().toString(), " Player save data is null")
return
Expand All @@ -114,7 +114,7 @@ class BuildingPageManager
incrementPageIndex()
setHighlightVisible(false)

let playerSaveData = (PlayerSaveData.getPlayerSaveData(m_player) castTo PlayerSaveData_v801)
let playerSaveData = PlayerSaveDataVersioned.getPlayerSaveData(m_player)
if (playerSaveData == null)
Log.debug("BBM", "onNextPageButtonClicked", m_player.getId().toString(), " Player save data is null")
return
Expand Down Expand Up @@ -159,5 +159,5 @@ init
PlayerSaveData.onLoadComplete().register() ->
for i = 0 to bj_MAX_PLAYER_SLOTS - 1
if (g_pageManagers[i] != null and players[i].isIngame())
let saveData = PlayerSaveData.getPlayerSaveData(players[i]) castTo PlayerSaveData_v801
let saveData = PlayerSaveDataVersioned.getPlayerSaveData(players[i])
g_pageManagers[i].setHighlightVisible(saveData.showBuildMenuHighlight)
20 changes: 14 additions & 6 deletions wurst/Survivors/Survivors.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import GameInstance
import Spawning
import Notifications

constant real SURVIVOR_SPAWN_TELEPORT_THRESHOLD_SQ = 4000.0*4000.0

group g_tempGroup = CreateGroup()
WeightedSet<SurvivorJobType> g_weightedSurvivorJobSet

Expand Down Expand Up @@ -155,13 +157,19 @@ public class SurvivorUtility
return null

let spawnPointResult = getSpawnPoint(_player)
if (not spawnPointResult.succeeded)
Log.debug("[spawnSurvivorUnitForPlayer] Failed to find spawn point for survivor, trying again")
// try again
doAfter(1.0, () -> spawnSurvivorUnitForPlayer(_player))
return null

let survivor = spawnSurvivorWithRandomJob(_player, spawnPointResult.spawnPoint, g_weightedSurvivorJobSet)
let campCenter = playerHumanComp.getCampCenter()

var spawnPoint = spawnPointResult.spawnPoint

// If a player builds their HQ tent before the grid-based spawn system is ready then the spawn
// point request will fail or it will succeed and return a spawn point in the subset of grid
// cells that have completed initialization which may be very far away from the camp center.
// In those cases just teleport the survivor to the camp center.
if (not spawnPointResult.succeeded or spawnPoint.distanceToSq(campCenter) > SURVIVOR_SPAWN_TELEPORT_THRESHOLD_SQ)
spawnPoint = campCenter

let survivor = spawnSurvivorWithRandomJob(_player, spawnPoint, g_weightedSurvivorJobSet)

survivor.issuePointOrderById(OrderIds.move, playerHumanComp.getCampCenter())

Expand Down
Loading

0 comments on commit 908d0d3

Please sign in to comment.