Skip to content

Commit 3654317

Browse files
committed
1.12.13
1 parent 780ca29 commit 3654317

34 files changed

+727
-534
lines changed

Dam Defense/Items/Items.xml

Lines changed: 100 additions & 7 deletions
Large diffs are not rendered by default.

Dam Defense/Items/Machines.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,22 @@
698698
<sprite texture="%ModDir%/Items/shop.png" sourcerect="721,0,238,396" depth="0.1" origin="0.5,0.5" alpha="1.0" />
699699
</LightComponent>
700700
</Item>
701+
<!-- Security Nexshop -->
702+
<Item name="Security Nexshop" identifier="secnexshop" tags="secnexshop" width="209" height="130" texturescale="1.0,1.0" scale="0.5" category="Machine,Decorative">
703+
<sprite texture="%ModDir%/Items/machines.png" sourcerect="544,0,209,130" depth="0.97" premultiplyalpha="false" origin="0.5,0.5" />
704+
<Fabricator canbeselected="true" powerconsumption="0.0" msg="ItemMsgInteractSelect" createbuttontext="campaignstoretab.buy">
705+
<RequiredItem identifier="idcard" type="Picked" msg="ItemMsgUnauthorizedAccess" />
706+
<GuiFrame relativesize="0.4,0.5" style="ItemUI" anchor="Center" />
707+
<sound file="%ModDir%/Sounds/shop.ogg" type="OnActive" range="200.0" loop="true"/>
708+
</Fabricator>
709+
<ItemContainer capacity="5" canbeselected="true" hideitems="true" slotsperrow="5" uilabel="" allowuioverlap="true">
710+
<Containable items="money" excludedidentifiers="fakemoney" />
711+
</ItemContainer>
712+
<ItemContainer capacity="1" canbeselected="true" hideitems="true" slotsperrow="1" uilabel="" allowuioverlap="true"/>
713+
<LightComponent range="0.0" lightcolor="0,255,255,111" IsOn="true" castshadows="false" alphablend="false" allowingameediting="false">
714+
<sprite texture="%ModDir%/Items/machines.png" sourcerect="753,0,209,130" depth="0.1" origin="0.5,0.5" alpha="1.0" />
715+
</LightComponent>
716+
</Item>
701717
<!-- nukieshops -->
702718
<Item name="Nukieshop" identifier="nukieshop1" tags="nukieshop" width="238" height="396" texturescale="1.0,1.0" scale="0.5" category="Machine,Decorative">
703719
<sprite texture="shop.png" sourcerect="1,400,238,396" depth="0.97" premultiplyalpha="false" origin="0.5,0.5" />

Dam Defense/Items/Medicines.xml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@
6868
<Price storeidentifier="merchantmine"/>
6969
<Price storeidentifier="merchantmedical" minavailable="2" multiplier="0.9"/>
7070
</Price>
71+
<Fabricate suitablefabricators="secnexshop" requiredtime="1">
72+
<RequiredItem tag="realmoney" amount="3" />
73+
</Fabricate>
7174
<Fabricate suitablefabricators="nexshop" requiredtime="1">
7275
<RequiredItem tag="money" amount="5" />
7376
</Fabricate>
@@ -322,6 +325,9 @@
322325
<Fabricate suitablefabricators="nukieshop" requiredtime="1" amount="1">
323326
<RequiredItem tag="fakemoney" amount="3" />
324327
</Fabricate>
328+
<Fabricate suitablefabricators="secnexshop" requiredtime="1">
329+
<RequiredItem tag="realmoney" amount="2" />
330+
</Fabricate>
325331
<Fabricate suitablefabricators="nexshop" requiredtime="1">
326332
<RequiredItem tag="money" amount="4" />
327333
</Fabricate>
@@ -453,6 +459,9 @@
453459
<Price storeidentifier="merchantmine" sold="false" />
454460
</Price>
455461
<Fabricate suitablefabricators="vendingmachine" requiredtime="1" requiredmoney="190" fabricationlimitmin="0" fabricationlimitmax="10"/>
462+
<Fabricate suitablefabricators="secnexshop" requiredtime="1">
463+
<RequiredItem tag="realmoney" amount="1" />
464+
</Fabricate>
456465
<Fabricate suitablefabricators="nexshop" requiredtime="1">
457466
<RequiredItem tag="money" amount="2" />
458467
</Fabricate>
@@ -485,6 +494,9 @@
485494
<Price storeidentifier="merchantmilitary"/>
486495
<Price storeidentifier="merchantmine"/>
487496
</Price>
497+
<Fabricate suitablefabricators="secnexshop" requiredtime="1">
498+
<RequiredItem tag="realmoney" amount="2" />
499+
</Fabricate>
488500
<Fabricate suitablefabricators="nexshop" requiredtime="1">
489501
<RequiredItem tag="money" amount="4" />
490502
</Fabricate>
@@ -538,6 +550,9 @@
538550
<Fabricate suitablefabricators="fabricator" requiredtime="5" requiresrecipe="true">
539551
<RequiredItem identifier="pipetobacco" />
540552
</Fabricate>
553+
<Fabricate suitablefabricators="secnexshop" requiredtime="1">
554+
<RequiredItem tag="realmoney" amount="1" />
555+
</Fabricate>
541556
<Fabricate suitablefabricators="nexshop" requiredtime="1">
542557
<RequiredItem tag="money" amount="1" />
543558
</Fabricate>
@@ -585,6 +600,9 @@
585600
<Price storeidentifier="merchantmine" sold="false" multiplier="1.1" />
586601
<Price storeidentifier="merchantmedical" multiplier="0.9" minavailable="4" />
587602
</Price>
603+
<Fabricate suitablefabricators="secnexshop" requiredtime="1">
604+
<RequiredItem tag="realmoney" amount="4" />
605+
</Fabricate>
588606
<Fabricate suitablefabricators="nexshop" requiredtime="1">
589607
<RequiredItem tag="money" amount="8" />
590608
</Fabricate>
@@ -631,6 +649,9 @@
631649
<Price storeidentifier="merchantmine" sold="false" multiplier="1.1" />
632650
<Price storeidentifier="merchantmedical" multiplier="0.9" minavailable="15" />
633651
</Price>
652+
<Fabricate suitablefabricators="secnexshop" requiredtime="1">
653+
<RequiredItem tag="realmoney" amount="1" />
654+
</Fabricate>
634655
<Fabricate suitablefabricators="nexshop" requiredtime="1">
635656
<RequiredItem tag="money" amount="2" />
636657
</Fabricate>
@@ -797,6 +818,9 @@
797818
<Price storeidentifier="merchanthusk" minavailable="0" maxavailable="2"/>
798819
</Price>
799820
<Fabricate suitablefabricators="vendingmachine" requiredtime="1" requiredmoney="60" fabricationlimitmin="5" fabricationlimitmax="10"/>
821+
<Fabricate suitablefabricators="secnexshop" requiredtime="1">
822+
<RequiredItem tag="realmoney" amount="3" />
823+
</Fabricate>
800824
<Fabricate suitablefabricators="nexshop" requiredtime="1">
801825
<RequiredItem tag="money" amount="5" />
802826
</Fabricate>
@@ -914,7 +938,7 @@
914938
<ReduceAffliction identifier="psychosis" amount="10.0" />
915939
</StatusEffect>
916940
<StatusEffect type="OnSecondaryUse" target="UseTarget" disabledeltatime="false" delay="10" duration="10">
917-
<ReduceAffliction identifier="huskinfection" amount="11.0" />
941+
<ReduceAffliction identifier="huskinfection" amount="4.0" />
918942
</StatusEffect>
919943
<!-- When Rum is used in Health GUI -->
920944
<StatusEffect type="OnUse" target="This, Limb" duration="5">
@@ -950,6 +974,9 @@
950974
<Fabricate suitablefabricators="nexshop" requiredtime="1">
951975
<RequiredItem tag="money" amount="2" />
952976
</Fabricate>
977+
<Fabricate suitablefabricators="secnexshop" requiredtime="1">
978+
<RequiredItem tag="realmoney" amount="1" />
979+
</Fabricate>
953980
<Fabricate suitablefabricators="nukieshop" requiredtime="1" amount="1">
954981
<RequiredItem tag="fakemoney" amount="1" />
955982
</Fabricate>
@@ -1474,6 +1501,9 @@
14741501
<RequiredItem identifier="adrenaline" />
14751502
<RequiredItem identifier="stabilozine" />
14761503
</Fabricate>
1504+
<Fabricate suitablefabricators="secnexshop" requiredtime="1">
1505+
<RequiredItem tag="realmoney" amount="5" />
1506+
</Fabricate>
14771507
<Fabricate suitablefabricators="nexshop" requiredtime="1">
14781508
<RequiredItem tag="money" amount="10" />
14791509
</Fabricate>

Dam Defense/Items/machines.png

50.4 KB
Loading

Dam Defense/Localizations/english.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ return {
88
commandHelpMisspell = '"{command}" is not a valid chat command. Do "/help" for a list of chat commands.',
99
commandHelpInvalid = '"{command}" is a valid chat command, but it is unusable by you in the current context. Do "/help" for a list of chat commands.',
1010
commandInfoMonster = 'You are a monster and your objective is to antagonize the humans.',
11-
commandNeverantagExempt = 'You are not exempt from being an antag. Does not apply whilst you are dead.',
11+
commandNeverantagExempt = 'You are now exempt from being an antag. Does not apply whilst you are dead.',
1212
commandNeverantagEligible = 'You are now eligible to being an antag. Does not apply whilst you have an antag safe job.',
1313
commandPossessErrorDead = 'You have to be dead to use this command.',
1414
commandPossessErrorNothingNearby = 'No nearby character fit to be possessed was found.',

Dam Defense/Localizations/english.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@
154154
<entityname.nexshop2>Nexshop</entityname.nexshop2>
155155
<entitydescription.nexshop1>The Nexshop (TM) is an always functioning vending machine to give you the goods you need.</entitydescription.nexshop1>
156156
<entitydescription.nexshop2>The Nexshop (TM) is an always functioning vending machine to give you the goods you need.</entitydescription.nexshop2>
157+
<!-- Security Nexshop -->
158+
<entityname.secnexshop>Security Nexshop</entityname.secnexshop>
159+
<entitydescription.secnexshop>A security Nexshop (TM) vending machine for law enforcement to buy weapons and ammo from at a discounted price. Immune to spoof counterfeit credits.</entitydescription.secnexshop>
157160
<!-- Nukieshop -->
158161
<entityname.nukieshop1>Nukieshop</entityname.nukieshop1>
159162
<entityname.nukieshop2>Nukieshop</entityname.nukieshop2>

Dam Defense/Lua/Autorun/main.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ DD.chatMessageFunctions.help = function (message, sender)
316316
specialCommands = tbl
317317

318318
specialCommands['help'] = true
319+
specialCommands['neverantag'] = true
319320
if Game.RoundStarted then
320321
specialCommands['events'] = true
321322
if DD.isClientCharacterAlive(sender) then
@@ -425,10 +426,10 @@ DD.chatMessageFunctions.neverantag = function (message, sender)
425426
if message ~= '/neverantag' then return end
426427

427428
if DD.antagExemptClients[sender.AccountId.StringRepresentation] then
428-
DD.messageClient(sender, DD.stringLocalize('commandNeverantagExempt'), {preset = 'command'})
429+
DD.messageClient(sender, DD.stringLocalize('commandNeverantagEligible'), {preset = 'command'})
429430
DD.antagExemptClients[sender.AccountId.StringRepresentation] = nil
430431
else
431-
DD.messageClient(sender, DD.stringLocalize('commandNeverantagEligible'), {preset = 'command'})
432+
DD.messageClient(sender, DD.stringLocalize('commandNeverantagExempt'), {preset = 'command'})
432433
DD.antagExemptClients[sender.AccountId.StringRepresentation] = true
433434
end
434435
DD.saving.autoSave({'antagExemptClients'})

Dam Defense/Lua/DD/eventDirector.lua

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ DD.eventDirector.eventsPerClientCap = 2 -- how many events a single client can b
5858
DD.eventDirector.mainEventCap = 1 -- how many main events can be active at the same time (negative values means it is uncapped)
5959
DD.eventDirector.canMainEventBeRegularEvent = false -- can a main event be called when a regular event is to be started
6060
DD.eventDirector.mainEventsDisableRespawning = true -- if there is any active main event then respawning will be disabled
61+
DD.eventDirector.goodnessBiasInitial = -3 -- offsets goodness
62+
DD.eventDirector.goodnessBiasGrowth = 1 / 60 / 10 -- per second
63+
DD.eventDirector.cooldownDecrementInitial = 1 -- per second
64+
DD.eventDirector.cooldownDecrementGrowth = 1 / 60 / 20 -- per second
6165

6266
-- Debug function
6367
DD.eventDirector.debug = function (list)
@@ -125,6 +129,8 @@ DD.eventDirector.getClientEvents = function (client)
125129

126130
return events
127131
end
132+
133+
-- Sees if client is below configured event cap
128134
DD.eventDirector.isClientBelowEventCap = function (client)
129135
if DD.eventDirector.eventsPerClientCap <= 0 then return true end
130136

@@ -294,6 +300,18 @@ Hook.Add("character.death", "DD.friendlyFireDetector", function(character)
294300
return true
295301
end)
296302

303+
304+
-- calculates the weight of an event
305+
local calculateEventWeight = function (eventClass)
306+
if ((eventClass.tbl.isMainEvent ~= isMainEvent) and not (eventClass.tbl.isMainEvent and DD.eventDirector.canMainEventBeRegularEvent)) or
307+
(eventClass.tbl.minimunAlivePercentage > alivePercentage) or (eventClass.tbl.minimunDeadPercentage > deadPercentage) then
308+
return 0
309+
end
310+
local directorGoodness = DD.eventDirector.goodness + DD.eventDirector.goodnessBiasInitial + DD.eventDirector.goodnessBiasGrowth * DD.roundTimer
311+
local weight = eventClass.tbl.weight / math.max(0.5, math.abs(eventClass.tbl.goodness + directorGoodness))
312+
return math.max(0, weight)
313+
end
314+
297315
-- Start a new event
298316
DD.eventDirector.startNewEvent = function (isMainEvent)
299317
local isMainEvent = isMainEvent
@@ -315,12 +333,10 @@ DD.eventDirector.startNewEvent = function (isMainEvent)
315333

316334
-- Get weights
317335
local weights = {}
318-
for key, value in pairs(DD.eventDirector.eventPool) do
319-
if (value.tbl.isMainEvent == isMainEvent) or (value.tbl.isMainEvent and DD.eventDirector.canMainEventBeRegularEvent) then
320-
weights[key] = math.max(0, value.tbl.weight - value.tbl.weight * value.tbl.goodness * DD.eventDirector.goodness)
321-
end
322-
if (value.tbl.minimunAlivePercentage > alivePercentage) or (value.tbl.minimunDeadPercentage > deadPercentage) then
323-
weights[key] = 0
336+
for key, eventClass in pairs(DD.eventDirector.eventPool) do
337+
local weight = calculateEventWeight(eventClass)
338+
if weight > 0 then
339+
weights[key] = weight
324340
end
325341
end
326342
-- Start event
@@ -330,7 +346,7 @@ DD.eventDirector.startNewEvent = function (isMainEvent)
330346
event.start(event)
331347

332348
if not event.failed then
333-
DD.eventDirector.goodness = DD.eventDirector.goodness + event.goodness / 2
349+
DD.eventDirector.goodness = DD.eventDirector.goodness + event.goodness
334350
DD.eventDirector.cooldown = event.cooldown
335351
if isMainEvent then
336352
DD.eventDirector.mainEventCooldown = event.cooldown
@@ -377,23 +393,28 @@ DD.thinkFunctions.eventDirector = function ()
377393
if (DD.thinkCounter % 30 ~= 0) or (not Game.RoundStarted) or (DD.roundData.roundEnding) then return end
378394
local timesPerSecond = 2
379395

396+
-- get current cooldown value decrement amount
397+
local cooldownDecrement = math.round(DD.eventDirector.cooldownDecrementInitial + DD.roundTimer * DD.eventDirector.cooldownDecrementGrowth, 1)
398+
399+
-- main event
380400
if (DD.eventDirector.mainEvent == nil) and (DD.eventDirector.mainEventCooldown <= 0) then
381401
DD.eventDirector.startNewEvent(true)
382-
DD.eventDirector.mainEventCooldown = 1
402+
DD.eventDirector.mainEventCooldown = 1 -- I don't know if this line is needed, but I rather play it safe
383403
else
384-
DD.eventDirector.mainEventCooldown = DD.eventDirector.mainEventCooldown - 1 / timesPerSecond
404+
DD.eventDirector.mainEventCooldown = DD.eventDirector.mainEventCooldown - cooldownDecrement / timesPerSecond
385405
end
386406

407+
-- side/minor events
387408
if DD.eventDirector.cooldown <= 0 then
388409
DD.eventDirector.startNewEvent()
389410
else
390-
DD.eventDirector.cooldown = DD.eventDirector.cooldown - 1 / timesPerSecond
411+
DD.eventDirector.cooldown = DD.eventDirector.cooldown - cooldownDecrement / timesPerSecond
391412
end
392413
end
393414

394415
-- Called at round start
395416
DD.roundStartFunctions.eventDirector = function ()
396-
DD.eventDirector.goodness = -3 -- negative goodness means lots of bad events happened, and thus event director will favour good events
417+
DD.eventDirector.goodness = 0
397418
DD.eventDirector.mainEvent = nil
398419
DD.eventDirector.events = {}
399420
DD.eventDirector.cooldown = 60 * 4

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ DD.eventAfflictionTB = DD.class(DD.eventAffliction, nil, {
5353
isMainEvent = false,
5454
cooldown = 60 * 2,
5555
weight = 0.2,
56-
goodness = -2,
56+
goodness = -3,
5757

5858
identifier = 'tbinfection',
5959
minamount = 1,

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ DD.eventAirdropMedical = DD.class(DD.eventAirdrop, nil, {
101101
name = 'airdropMedical',
102102
isMainEvent = false,
103103
cooldown = 60 * 2,
104-
weight = 1.5,
105-
goodness = 1.5,
104+
weight = 2,
105+
goodness = 1,
106106

107107
spawnPosition = 'dd_airdropmedical',
108108
crateIdentifier = 'mediccrate',
@@ -130,8 +130,8 @@ DD.eventAirdropSecurity = DD.class(DD.eventAirdrop, nil, {
130130
name = 'airdropSecurity',
131131
isMainEvent = false,
132132
cooldown = 60 * 2,
133-
weight = 1,
134-
goodness = 1.2,
133+
weight = 1.5,
134+
goodness = 2,
135135

136136
spawnPosition = 'dd_airdropsecurity',
137137
crateIdentifier = 'securemetalcrate',
@@ -156,8 +156,8 @@ DD.eventAirdropArtifact = DD.class(DD.eventAirdrop, nil, {
156156
name = 'airdropArtifact',
157157
isMainEvent = false,
158158
cooldown = 60 * 2,
159-
weight = 2,
160-
goodness = 0.5,
159+
weight = 1.5,
160+
goodness = 0,
161161

162162
spawnPosition = 'dd_airdropartifact',
163163
crateIdentifier = 'none',

0 commit comments

Comments
 (0)