Skip to content

Commit db606cb

Browse files
committed
1.2.15
1 parent f220d1c commit db606cb

File tree

15 files changed

+533
-484
lines changed

15 files changed

+533
-484
lines changed

Dam Defense/Lua/Autorun/main.lua

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ DD.thinkFunctions.main = function ()
235235
-- End round if everyone is dead
236236
local anyHumanAlive = false
237237
for client in Client.ClientList do
238-
if DD.isClientCharacterAlive(client) and client.Character.SpeciesName == 'human' then
238+
if not DD.isClientAntagNonTarget(client) then
239239
anyHumanAlive = true
240240
break
241241
end
@@ -736,6 +736,13 @@ Hook.Add("character.giveJobItems", "DD.onGiveJobItems", function (character)
736736
local nonInteractable = item.SerializableProperties[Identifier("NonInteractable")]
737737
Networking.CreateEntityEvent(item, Item.ChangePropertyEventData(nonInteractable, item))
738738
end
739+
elseif character.JobIdentifier == 'assistant' then
740+
Entity.Spawner.AddItemToSpawnQueue(ItemPrefab.GetItemPrefab('handcuffs'), character.Inventory, nil, nil, function (spawnedItem)
741+
spawnedItem.Condition = spawnedItem.Condition / 10
742+
Timer.NextFrame(function ()
743+
character.Inventory.TryPutItem(spawnedItem, DD.invSlots.righthand, true, true, character, true, true)
744+
end)
745+
end)
739746
end
740747
-- Give Talents
741748
if character.SpeciesName == 'human' then
@@ -747,7 +754,7 @@ Hook.Add("character.giveJobItems", "DD.onGiveJobItems", function (character)
747754
character.GiveTalent('janitorialknowledge', true)
748755
character.GiveTalent('greenthumb', true)
749756
end
750-
if (character.JobIdentifier == 'engineer') or (character.JobIdentifier == 'foreman') or (character.JobIdentifier == 'jet') or (character.JobIdentifier == 'assistant') then
757+
if (character.JobIdentifier == 'engineer') or (character.JobIdentifier == 'foreman') then
751758
character.GiveTalent('unstoppablecuriosity', true)
752759
end
753760
if (character.JobIdentifier == 'captain') or (character.JobIdentifier == 'gangster') or (character.JobIdentifier == 'assistant') then
@@ -756,7 +763,7 @@ Hook.Add("character.giveJobItems", "DD.onGiveJobItems", function (character)
756763
if DD.isCharacterMedical(character) or (character.JobIdentifier == 'janitor') or (character.JobIdentifier == 'assistant') then
757764
character.GiveTalent('firemanscarry', true)
758765
end
759-
if (character.JobIdentifier == 'diver') or (character.JobIdentifier == 'engineer') or (character.JobIdentifier == 'foreman') or (character.JobIdentifier == 'jet') or (character.JobIdentifier == 'assistant') then
766+
if (character.JobIdentifier == 'diver') or (character.JobIdentifier == 'engineer') or (character.JobIdentifier == 'foreman') or (character.JobIdentifier == 'jet') or (character.JobIdentifier == 'mercsevil') or (character.JobIdentifier == 'assistant') then
760767
character.GiveTalent('daringdolphin', true)
761768
character.GiveTalent('ballastdenizen', true)
762769
end

Dam Defense/Lua/DD/events/bloodCult.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ end, {
2121

2222
local aliveSet = {}
2323
for client in Client.ClientList do
24-
if DD.isClientCharacterAlive(client) and (client.Character.SpeciesName == 'human') then
24+
if not DD.isClientAntagNonTarget(client) then
2525
aliveSet[client] = true
2626
end
2727
end

Dam Defense/Lua/DD/events/chimera.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ end, {
1010
instanceCap = 1,
1111
isMainEvent = false,
1212
cooldown = 60 * 3,
13-
weight = 1.5,
13+
weight = 2,
1414
goodness = -4,
1515
minimunDeadPercentage = 0.05,
1616
minimunTimeElapsed = 5 * 60,

Dam Defense/Lua/DD/events/deathSquad.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ end, {
1515
weight = 4,
1616
goodness = -5,
1717
minimunDeadPercentage = 0.2,
18-
minimunTimeElapsed = 30 * 60,
18+
minimunTimeElapsed = 20 * 60,
1919

2020
lateJoinBlacklistSet = {},
2121
lateJoinSpawn = function (self, client)
@@ -96,7 +96,7 @@ end, {
9696
-- See if any non-nukie is alive
9797
local anyNonNukieAlive = false
9898
for client in Client.ClientList do
99-
if DD.isClientCharacterAlive(client) and (client.Character.SpeciesName == 'human') and (not self.nukiesSet[client]) then
99+
if (not DD.isClientAntagNonTarget(client)) and (not self.nukiesSet[client]) then
100100
anyNonNukieAlive = true
101101
break
102102
end

Dam Defense/Lua/DD/events/greenskins.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ end, {
1515
weight = 3,
1616
goodness = -5,
1717
minimunDeadPercentage = 0.2,
18-
minimunTimeElapsed = 30 * 60,
18+
minimunTimeElapsed = 20 * 60,
1919

2020
lateJoinSpawn = function (self, client)
2121
-- Is Troll
@@ -99,6 +99,14 @@ end, {
9999
DD.giveAfflictionCharacter(client.Character, 'timepressure', 60/timeToExplode/timesPerSecond)
100100
end
101101

102+
-- Instant respawn as soon as any player is eligible for respawning
103+
for client in Client.ClientList do
104+
if DD.isClientRespawnable(client) and client.InGame then
105+
Game.DispatchRespawnSub()
106+
break
107+
end
108+
end
109+
102110
-- End event if goblins are dead
103111
if DD.tableSize(self.greenskins) <= 0 then
104112
self.finish()

Dam Defense/Lua/DD/events/mercs.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ end, {
1010
instanceCap = 1,
1111
isMainEvent = false,
1212
cooldown = 60 * 2,
13-
weight = 1,
13+
weight = 2,
1414
goodness = 3,
15-
minimunDeadPercentage = 0.2,
16-
minimunTimeElapsed = 15 * 60,
15+
minimunDeadPercentage = 0.1,
16+
minimunTimeElapsed = 12 * 60,
1717

1818
onStart = function (self)
1919
if self.mercs == nil then

Dam Defense/Lua/DD/events/nukies.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ end, {
1414
weight = 3,
1515
goodness = -4,
1616
minimunDeadPercentage = 0.2,
17-
minimunTimeElapsed = 15 * 60,
17+
minimunTimeElapsed = 12 * 60,
1818

1919
respawnTickets = 0,
2020
lateJoinBlacklistSet = {},
@@ -102,7 +102,7 @@ end, {
102102
-- See if any non-nukie is alive
103103
local anyNonNukieAlive = false
104104
for client in Client.ClientList do
105-
if DD.isClientCharacterAlive(client) and (client.Character.SpeciesName == 'human') and (not self.nukiesSet[client]) then
105+
if (not DD.isClientAntagNonTarget(client)) and (not self.nukiesSet[client]) then
106106
anyNonNukieAlive = true
107107
break
108108
end
@@ -155,7 +155,7 @@ end, {
155155
self.nukiesSet[nukie] = nil
156156
end
157157
end
158-
else
158+
elseif character.SpeciesName == 'human' then
159159
if (character.LastAttacker ~= nil) and self.nukiesSet[DD.findClientByCharacter(character.LastAttacker)] then
160160
self.respawnTickets = self.respawnTickets + 1
161161
DD.messageAllClients(DD.stringLocalize('nukiesTicketGained', {tickets = self.respawnTickets}), {preset = 'info'})

Dam Defense/Lua/DD/events/serialKiller.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ end, {
1010
isMainEvent = true,
1111
cooldown = 60 * 4,
1212
weight = 1,
13-
goodness = -1,
13+
goodness = -2,
1414
minimunAlivePercentage = 1.0,
1515

1616
getShouldFinish = function (self)
@@ -22,7 +22,7 @@ end, {
2222
-- See if anyone is still alive
2323
local anyoneAlive = false
2424
for client in Client.ClientList do
25-
if DD.isClientCharacterAlive(client) and (client.Character.SpeciesName == 'human') and (client ~= self.killer) then
25+
if (not DD.isClientAntagNonTarget(client)) and (client ~= self.killer) then
2626
anyoneAlive = true
2727
break
2828
end
@@ -33,7 +33,7 @@ end, {
3333
self.killerWon = true
3434
return true
3535
end
36-
if (not DD.isClientCharacterAlive(self.killer)) or ((self.killer.Character ~= nil) and DD.isCharacterArrested(self.killer.Character)) then
36+
if (not DD.isClientCharacterAlive(self.killer)) or ((self.killer.Character ~= nil) and self.killer.Character.IsHandcuffed) then
3737
return true
3838
end
3939
-- End event if killsLeftToWin is equal to or lower than 0
@@ -60,7 +60,7 @@ end, {
6060
self.killsLeftToWin = self.killsLeftToWin + 1
6161
end
6262
end
63-
self.killsLeftToWin = math.ceil(self.killsLeftToWin * 0.7)
63+
self.killsLeftToWin = math.ceil(self.killsLeftToWin * 0.6)
6464

6565
local nonSecurity = {}
6666
for client in Client.ClientList do

Dam Defense/Lua/DD/events/vip.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,17 @@ end, {
4949
job = 'jet'
5050
subclass = 1
5151
team = CharacterTeamType.Team2
52+
for event in DD.eventDirector.getEventInstances('nukies') do
53+
table.insert(event.nukies, self.guard)
54+
event.nukiesSet[self.guard] = true
55+
end
5256
elseif self.vip.Character.JobIdentifier == 'mercsevil' then
5357
job = 'mercsevil'
5458
team = CharacterTeamType.Team2
59+
for event in DD.eventDirector.getEventInstances('deathSquad') do
60+
table.insert(event.nukies, self.guard)
61+
event.nukiesSet[self.guard] = true
62+
end
5563
end
5664
local character = DD.spawnHuman(self.guard, job, pos, nil, subclass)
5765
character.SetOriginalTeamAndChangeTeam(team, true)

Dam Defense/Lua/DD/spawning.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ DD.autoJob = function ()
3030
end
3131
end
3232

33+
local clientPreferredJobsSet = {}
34+
for client in Client.ClientList do
35+
clientPreferredJobsSet[client] = {}
36+
for index, jobVariant in pairs(client.JobPreferences) do
37+
clientPreferredJobsSet[client][tostring(jobVariant.Prefab.Identifier)] = true
38+
end
39+
end
40+
3341
local jobsLeft = {}
3442
local sorted = {}
3543
for jobPrefab in JobPrefab.Prefabs do
@@ -91,7 +99,7 @@ DD.autoJob = function ()
9199
for otherClient in Client.ClientList do
92100
if client == otherClient then clientFound = true end
93101
end
94-
if clientFound and (jobsLeft[job] > 0) and jobSet[job] and (job ~= 'mechanic') and (not DD.isClientBannedFromJob(client, job)) then
102+
if (DD.clientJob[client] == nil) and clientFound and (jobsLeft[job] > 0) and jobSet[job] and clientPreferredJobsSet[client][job] and (not DD.isClientBannedFromJob(client, job)) then
95103
assignClientJob(client, job)
96104
end
97105
end

0 commit comments

Comments
 (0)