Skip to content

Commit bb4b502

Browse files
committed
xd
1 parent acae3be commit bb4b502

File tree

6 files changed

+194
-21
lines changed

6 files changed

+194
-21
lines changed

alcoholism/config.lua

Lines changed: 154 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,157 @@
1-
lia.config.add("AlcoholTickTime", "Alcohol Tick Time", 30, nil, {
1+
MODULE.AlcoholItems = {
2+
vodka_bottle = {
3+
name = "Vodka",
4+
model = "models/props_junk/glassjug01.mdl",
5+
abv = 40,
6+
weight = 0.8,
7+
price = 45,
8+
category = "Alcohol",
9+
width = 1,
10+
height = 2
11+
},
12+
whiskey_bottle = {
13+
name = "Whiskey",
14+
model = "models/props_junk/garbage_glassbottle003a.mdl",
15+
abv = 43,
16+
weight = 0.9,
17+
price = 60,
18+
category = "Alcohol",
19+
width = 1,
20+
height = 2
21+
},
22+
red_wine = {
23+
name = "Red Wine",
24+
model = "models/props_junk/garbage_glassbottle002a.mdl",
25+
abv = 13,
26+
weight = 1.1,
27+
price = 35,
28+
category = "Alcohol",
29+
width = 1,
30+
height = 2
31+
},
32+
white_wine = {
33+
name = "White Wine",
34+
model = "models/props_junk/garbage_glassbottle001a.mdl",
35+
abv = 12,
36+
weight = 1.1,
37+
price = 33,
38+
category = "Alcohol",
39+
width = 1,
40+
height = 2
41+
},
42+
lager_can = {
43+
name = "Lager",
44+
model = "models/props_junk/popcan01a.mdl",
45+
abv = 5,
46+
weight = 0.2,
47+
price = 6,
48+
category = "Alcohol",
49+
width = 1,
50+
height = 1
51+
},
52+
stout_bottle = {
53+
name = "Stout",
54+
model = "models/props_junk/garbage_glassbottle003a.mdl",
55+
abv = 6,
56+
weight = 0.3,
57+
price = 7,
58+
category = "Alcohol",
59+
width = 1,
60+
height = 1
61+
},
62+
rum_bottle = {
63+
name = "Rum",
64+
model = "models/props_junk/glassjug01.mdl",
65+
abv = 37,
66+
weight = 0.85,
67+
price = 50,
68+
category = "Alcohol",
69+
width = 1,
70+
height = 2
71+
},
72+
gin_bottle = {
73+
name = "Gin",
74+
model = "models/props_junk/garbage_glassbottle003a.mdl",
75+
abv = 41,
76+
weight = 0.8,
77+
price = 48,
78+
category = "Alcohol",
79+
width = 1,
80+
height = 2
81+
},
82+
tequila_bottle = {
83+
name = "Tequila",
84+
model = "models/props_junk/glassjug01.mdl",
85+
abv = 38,
86+
weight = 0.85,
87+
price = 52,
88+
category = "Alcohol",
89+
width = 1,
90+
height = 2
91+
},
92+
cider_bottle = {
93+
name = "Cider",
94+
model = "models/props_junk/garbage_glassbottle002a.mdl",
95+
abv = 4,
96+
weight = 0.35,
97+
price = 8,
98+
category = "Alcohol",
99+
width = 1,
100+
height = 1
101+
},
102+
mead_flask = {
103+
name = "Mead",
104+
model = "models/props_junk/garbage_glassbottle001a.mdl",
105+
abv = 10,
106+
weight = 0.6,
107+
price = 22,
108+
category = "Alcohol",
109+
width = 1,
110+
height = 1
111+
},
112+
moonshine_jar = {
113+
name = "Moonshine",
114+
model = "models/props_lab/jar01b.mdl",
115+
abv = 60,
116+
weight = 0.7,
117+
price = 75,
118+
category = "Alcohol",
119+
width = 1,
120+
height = 1
121+
},
122+
absinthe_bottle = {
123+
name = "Absinthe",
124+
model = "models/props_junk/garbage_glassbottle003a.mdl",
125+
abv = 68,
126+
weight = 0.8,
127+
price = 95,
128+
category = "Alcohol",
129+
width = 1,
130+
height = 2
131+
},
132+
sake_bottle = {
133+
name = "Sake",
134+
model = "models/props_junk/glassjug01.mdl",
135+
abv = 15,
136+
weight = 0.7,
137+
price = 28,
138+
category = "Alcohol",
139+
width = 1,
140+
height = 2
141+
},
142+
soju_bottle = {
143+
name = "Soju",
144+
model = "models/props_junk/garbage_glassbottle001a.mdl",
145+
abv = 19,
146+
weight = 0.55,
147+
price = 18,
148+
category = "Alcohol",
149+
width = 1,
150+
height = 1
151+
}
152+
}
153+
154+
lia.config.add("AlcoholTickTime", "Alcohol Tick Time", 30, nil, {
2155
desc = "Time interval (in seconds) for alcohol degradation.",
3156
category = "Alcoholism",
4157
type = "Int",

alcoholism/items/alcohol/beer.lua

Lines changed: 0 additions & 6 deletions
This file was deleted.

alcoholism/items/base/alcohol.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ ITEM.functions.use = {
1919
client:EmitSound("vo/npc/male01/drink01.wav", 75, 100)
2020
return true
2121
end,
22-
}
22+
}

alcoholism/libraries/server.lua

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,42 @@ end
2020
function MODULE:StartCommand(client, cmd)
2121
if (client.nextDrunkCheck or 0) < CurTime() then
2222
client.nextDrunkCheck = CurTime() + lia.config.get("AlcoholEffectDelay", 0.03)
23-
if client:getNetVar("lia_alcoholism_bac", 0) > 30 then
23+
local bac = client:getNetVar("lia_alcoholism_bac", 0)
24+
if bac > 30 then
2425
cmd:ClearButtons()
2526
if (client.nextDrunkSide or 0) < CurTime() then
26-
client.nextDrunkSide = CurTime() + math.Rand(0.1, 0.3) + client:getNetVar("lia_alcoholism_bac", 0) * 0.01
27+
client.nextDrunkSide = CurTime() + math.Rand(0.1, 0.3) + bac * 0.01
2728
client.sideRoll = math.random(-1, 1)
2829
client.frontRoll = math.random(-1, 1)
2930
end
3031

32+
local mult = 1
33+
if (client.intenseSwerveUntil or 0) > CurTime() then mult = lia.config.get("AlcoholIntenseMultiplier", 2) end
3134
if client.frontRoll == 1 then
32-
cmd:SetForwardMove(100000)
35+
cmd:SetForwardMove(100000 * mult)
3336
elseif client.frontRoll == -1 then
34-
cmd:SetForwardMove(-100000)
37+
cmd:SetForwardMove(-100000 * mult)
3538
end
3639

3740
if client.sideRoll == 1 then
38-
cmd:SetSideMove(100000)
41+
cmd:SetSideMove(100000 * mult)
3942
elseif client.sideRoll == -1 then
40-
cmd:SetSideMove(-100000)
43+
cmd:SetSideMove(-100000 * mult)
4144
end
4245
end
4346
end
47+
48+
local bac = client:getNetVar("lia_alcoholism_bac", 0)
49+
if bac >= lia.config.get("AlcoholRagdollThreshold", 80) and (client.nextRagdollCheck or 0) < CurTime() then
50+
client.nextRagdollCheck = CurTime() + math.Rand(lia.config.get("AlcoholRagdollMin", 60), lia.config.get("AlcoholRagdollMax", 120))
51+
if client:Alive() and not client.liaRagdolled and client:GetVelocity():Length2D() > 10 and math.Rand(0, 100) <= lia.config.get("AlcoholRagdollChance", 35) then client:setRagdolled(true, lia.config.get("AlcoholRagdollDuration", 5)) end
52+
end
53+
end
54+
55+
function MODULE:BACChanged(client, newBac)
56+
local last = client.lastBAC or 0
57+
if newBac > last then client.intenseSwerveUntil = CurTime() + lia.config.get("AlcoholIntenseTime", 5) end
58+
client.lastBAC = newBac
4459
end
4560

4661
function MODULE:PlayerLoadedChar(client)
@@ -50,9 +65,6 @@ end
5065
function MODULE:PostPlayerLoadout(client)
5166
client:ResetBAC()
5267
end
53-
lia.log.addType("bacIncrease", function(client, amt, newBac)
54-
return string.format("%s BAC increased by %s to %s%%", client:Name(), amt, newBac)
55-
end, "Gameplay")
56-
lia.log.addType("bacReset", function(client)
57-
return string.format("%s became sober", client:Name())
58-
end, "Gameplay")
68+
69+
lia.log.addType("bacIncrease", function(client, amt, newBac) return string.format("%s BAC increased by %s to %s%%", client:Name(), amt, newBac) end, "Gameplay")
70+
lia.log.addType("bacReset", function(client) return string.format("%s became sober", client:Name()) end, "Gameplay")

alcoholism/libraries/shared.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function MODULE:InitializedModules()
2+
for id, d in pairs(self.AlcoholItems) do
3+
local ITEM = lia.item.register(id, "base_alcohol", nil, nil, true)
4+
ITEM.uniqueID = id
5+
ITEM.name = d.name
6+
ITEM.model = d.model or ""
7+
ITEM.category = d.category or "Alcohol"
8+
ITEM.price = d.price or 0
9+
ITEM.weight = d.weight or 0
10+
ITEM.height = d.height or 1
11+
ITEM.width = d.width or 1
12+
ITEM.abv = d.abv or 0
13+
end
14+
end

alcoholism/module.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ MODULE.discord = "@liliaplayer"
44
MODULE.version = 1.18
55
MODULE.desc = "Adds drinkable alcohol that increases a player's intoxication level. High BAC blurs vision and slows movement until the effect wears off."
66
MODULE.Public = true
7-
MODULE.Features = {"Adds alcohol items that raise BAC and gradually wear off", "Adds screen blur and movement effects that scale with intoxication", "Adds player notification when reaching DrunkNotifyThreshold", "Adds configurable BAC settings like AlcoholTickTime", "Adds multiple drink items with varying strength"}
7+
MODULE.Features = {"Adds alcohol items that raise BAC and gradually wear off", "Adds screen blur and movement effects that scale with intoxication", "Adds player notification when reaching DrunkNotifyThreshold", "Adds configurable BAC settings like AlcoholTickTime", "Adds multiple drink items with varying strength"}

0 commit comments

Comments
 (0)