-
Notifications
You must be signed in to change notification settings - Fork 15
Cannibal health gain and victim digestion #924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
29e123a
1dd91c9
eb85c9f
65c43ea
78b7b92
ab6fb68
534dfe1
98c9497
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -765,6 +765,14 @@ ttt_cannibal_damage_penalty 0 // The fraction a Canniba | |||||
| ttt_cannibal_can_see_jesters 0 // Whether jesters are revealed (via head icons, color/icon on the scoreboard, etc.) to the Cannibal (Only applies if ttt_cannibal_is_independent is enabled) | ||||||
| ttt_cannibal_update_scoreboard 0 // Whether the Cannibal shows dead players as missing in action (Only applies if ttt_cannibal_is_independent is enabled) | ||||||
|
|
||||||
|
|
||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| ttt_cannibal_gains_health 1 // Whether the Cannibal gains their victim's health when eating them | ||||||
| ttt_cannibal_gained_health_percentage 100 // What percentage of their victim's health the Cannibal gains (set to 0 to always gain a flat 100HP) | ||||||
| ttt_cannibal_digests_victims 1 // Whether the Cannibal digests and permanently kills their victims over time | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| ttt_cannibal_digestion_time 30 // How long in seconds a victim takes to be digested when eaten (set to 0 for immediate digestion) | ||||||
| ttt_cannibal_does_poopy 1 // Whether the Cannibal poops themselves when a victim is digested | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| ttt_cannibal_does_poopy_noise 1 // Whether the Cannibal's poops produce an audible cue | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| // ---------------------------------------- | ||||||
|
|
||||||
| // INDEPENDENT TEAM SETTINGS | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| "VertexLitGeneric" | ||
| { | ||
| "$baseTexture" "Models/poo/poo" | ||
| "$bumpmap" "Models/poo/poo_n" | ||
| // -- From here down is new stuff which will only be applied if $phong is set to 1 -- | ||
| "$phong" "1" | ||
| "$phongboost" "4" | ||
| "$phongexponent" "30" | ||
| "$phongfresnelranges" "[.2 .5 1]" | ||
| } |
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 4 of the 6 added ConVars are not used on the client can be:
|
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -37,13 +37,28 @@ SWEP.InLoadoutFor = {ROLE_CANNIBAL} | |||||
| SWEP.InLoadoutForDefault = {ROLE_CANNIBAL} | ||||||
|
|
||||||
| SWEP.DeviceCooldownConVar = CreateConVar("ttt_cannibal_eat_cooldown", "10", FCVAR_REPLICATED, "The amount of time (in seconds) between uses of the Cannibal's Cannibalizer", 0, 60) | ||||||
| SWEP.GainsHealthConVar = CreateConVar("ttt_cannibal_gains_health", "1", FCVAR_REPLICATED, "Whether the Cannibal gains their victim's health when eating them", 0, 1) | ||||||
| SWEP.GainedHealthPercentageConVar = CreateConVar("ttt_cannibal_gained_health_percentage", "100", FCVAR_REPLICATED, "What percentage of their victim's health the Cannibal gains (set to 0 to always gain a flat 100HP)", 0, 500) | ||||||
| SWEP.DigestsVictimsConVar = CreateConVar("ttt_cannibal_digests_victims", "1", FCVAR_REPLICATED, "Whether the Cannibal digests and permanently kills their victims over time", 0, 1) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| SWEP.DigestionTimeConVar = CreateConVar("ttt_cannibal_digestion_time", "30", FCVAR_REPLICATED, "How long in seconds a victim takes to be digested when eaten (set to 0 for immediate digestion)", 0, 300) | ||||||
| SWEP.RectallyIncontinentConVar = CreateConVar("ttt_cannibal_does_poopy", "1", FCVAR_REPLICATED, "Whether the Cannibal poops themselves when a victim is digested", 0, 1) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Funny, but no.
Suggested change
|
||||||
| SWEP.AudibleIncontinenceConVar = CreateConVar("ttt_cannibal_does_poopy_noise", "1", FCVAR_REPLICATED, "Whether the Cannibal's poops produce an audible cue", 0, 1) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| local eatSounds = { | ||||||
| "cannibal/eat1.wav", | ||||||
| "cannibal/eat2.wav", | ||||||
| "cannibal/eat3.wav" | ||||||
| } | ||||||
|
|
||||||
| local poopSounds = { | ||||||
| "cannibal/poop1.wav", | ||||||
| "cannibal/poop2.wav", | ||||||
| "cannibal/poop3.wav", | ||||||
| "cannibal/poop4.wav", | ||||||
| "cannibal/poop5.wav", | ||||||
| "cannibal/poop6.wav" | ||||||
| } | ||||||
|
|
||||||
| function SWEP:Initialize() | ||||||
| if CLIENT then | ||||||
| self:AddHUDHelp("can_eater_help_pri", nil, true) | ||||||
|
|
@@ -125,6 +140,84 @@ function SWEP:PrimaryAttack() | |||||
| if cooldown > 0 then | ||||||
| self:SetDeviceCooldownEnd(CurTime() + cooldown) | ||||||
| end | ||||||
|
|
||||||
| -- Cannibal health gain | ||||||
| if self.GainsHealthConVar:GetBool() then | ||||||
|
|
||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| local gainedhealthpercentage = self.GainedHealthPercentageConVar:GetInt() | ||||||
| local victimhealth = hitEnt:Health() | ||||||
| local cannibalhealth = owner:Health() | ||||||
|
|
||||||
| if gainedhealthpercentage == 0 then | ||||||
| gainedhealth = 100 | ||||||
| else | ||||||
| gainedhealthunrounded = (gainedhealthpercentage / 100) * victimhealth | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| gainedhealth = math.floor(gainedhealthunrounded) | ||||||
| end | ||||||
|
|
||||||
| local newcannibalhealth = cannibalhealth + gainedhealth | ||||||
| if newcannibalhealth > cannibalhealth then | ||||||
| owner:SetHealth(newcannibalhealth) | ||||||
| end | ||||||
|
|
||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| end | ||||||
|
|
||||||
| -- Victim digestion | ||||||
| if self.DigestsVictimsConVar:GetBool() then | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| local digestiontime = self.DigestionTimeConVar:GetInt() | ||||||
|
|
||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| if digestiontime == 0 then | ||||||
| digestiontime = 0.1 -- short delay to avoid fuckyness? | ||||||
| end | ||||||
|
|
||||||
| local disgestiontimername = "TTTCannibalDigestion_" .. sID64 | ||||||
|
|
||||||
| -- Remove existing digestion timer for victim if one somehow exists | ||||||
| if timer.Exists(disgestiontimername) then | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not necessary. |
||||||
| timer.Remove(disgestiontimername) | ||||||
| end | ||||||
|
|
||||||
| timer.Create(disgestiontimername, digestiontime, 1, function() | ||||||
|
|
||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| -- Safety checks | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| if not IsValid(hitEnt) or not hitEnt:IsPlayer() then return end | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| if not IsValid(owner) or not owner:IsPlayer() then return end | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| -- Only digest if they are still in THIS cannibal's tummy | ||||||
| if hitEnt.TTTCannibalEaten == owner:SteamID64() then | ||||||
| hitEnt:KillSilent() | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't use
Suggested change
|
||||||
| hitEnt:ClearProperty("TTTCannibalEaten") | ||||||
|
|
||||||
| hitEnt:SetParent(nil) | ||||||
| hitEnt:SpectateEntity(nil) | ||||||
|
|
||||||
| hitEnt:QueueMessage(MSG_PRINTBOTH, "You have been fully digested!", 3) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Most messages use the default length unless there is a good reason not to
Suggested change
|
||||||
| owner:QueueMessage(MSG_PRINTBOTH, "You have fully digested " .. hitEnt:Nick() .. "!", 3) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| -- Spawn poop at cannibal's position | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| if self.RectallyIncontinentConVar:GetBool() then | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| local poop = ents.Create("prop_physics") | ||||||
| if IsValid(poop) then | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Set |
||||||
| poop:SetModel("models/poo/poo.mdl") | ||||||
|
|
||||||
| local forward = owner:GetForward() | ||||||
| local dropPos = owner:GetPos() + forward * -30 + Vector(0, 0, 10) | ||||||
| poop:SetPos(dropPos) | ||||||
|
|
||||||
| poop:SetAngles(Angle(0, math.random(0, 360), 0)) | ||||||
| poop:Spawn() | ||||||
| poop:Activate() | ||||||
|
|
||||||
| if self.AudibleIncontinenceConVar:GetBool()then | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| owner:EmitSound(poopSounds[math.random(1, #poopSounds)], 100) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| end | ||||||
| end | ||||||
| end | ||||||
| end | ||||||
|
|
||||||
| end) | ||||||
| end | ||||||
| end | ||||||
| end | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -189,10 +189,21 @@ AddHook("TTTTutorialRoleText", "Cannibal_TTTTutorialRoleText", function(role, ti | |||
| local roleTeamName, roleColor = GetRoleTeamInfo(roleTeam) | ||||
| local html = "The " .. ROLE_STRINGS[ROLE_CANNIBAL] .. " is a <span style='color: rgb(" .. roleColor.r .. ", " .. roleColor.g .. ", " .. roleColor.b .. ")'>" .. roleTeamName .. "</span> role whose goal is to eat all other players." | ||||
|
|
||||
| html = html .. "<span style='display: block; margin-top: 10px;'>Eaten players are not dead, but they are <span style='color: rgb(" .. roleColor.r .. ", " .. roleColor.g .. ", " .. roleColor.b .. ")'>unable to do anything</span> except talk with other eaten players and spectate the " .. ROLE_STRINGS[ROLE_CANNIBAL] .. ".</span>" | ||||
| if GetConVar("ttt_cannibal_digests_victims"):GetBool() then | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor point, but the first paragraph is almost identical as below so it could be extracted and de-duplicated. |
||||
|
|
||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
| html = html .. "<span style='display: block; margin-top: 10px;'>Eaten players are not immediately dead, but they are <span style='color: rgb(" .. roleColor.r .. ", " .. roleColor.g .. ", " .. roleColor.b .. ")'>unable to do anything</span> except talk with other eaten players and spectate the " .. ROLE_STRINGS[ROLE_CANNIBAL] .. ".</span>" | ||||
|
|
||||
| html = html .. "<span style='display: block; margin-top: 10px;'>If the " .. ROLE_STRINGS[ROLE_CANNIBAL] .. " dies, all eaten players are <span style='color: rgb(" .. roleColor.r .. ", " .. roleColor.g .. ", " .. roleColor.b .. ")'>freed</span> at the position where the " .. ROLE_STRINGS[ROLE_CANNIBAL] .. " died.</span>" | ||||
| html = html .. "<span style='display: block; margin-top: 10px;'>Eaten players are <span style='color: rgb(" .. roleColor.r .. ", " .. roleColor.g .. ", " .. roleColor.b .. ")'>digested and killed </span>" .. GetConVar("ttt_cannibal_digestion_time"):GetInt() .. " seconds after being eaten.</span>" | ||||
|
|
||||
| html = html .. "<span style='display: block; margin-top: 10px;'>If the " .. ROLE_STRINGS[ROLE_CANNIBAL] .. " dies, all undigested eaten players are <span style='color: rgb(" .. roleColor.r .. ", " .. roleColor.g .. ", " .. roleColor.b .. ")'>freed</span> at the position where the " .. ROLE_STRINGS[ROLE_CANNIBAL] .. " died.</span>" | ||||
|
|
||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
| else | ||||
|
|
||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
| html = html .. "<span style='display: block; margin-top: 10px;'>Eaten players are not dead, but they are <span style='color: rgb(" .. roleColor.r .. ", " .. roleColor.g .. ", " .. roleColor.b .. ")'>unable to do anything</span> except talk with other eaten players and spectate the " .. ROLE_STRINGS[ROLE_CANNIBAL] .. ".</span>" | ||||
|
|
||||
| html = html .. "<span style='display: block; margin-top: 10px;'>If the " .. ROLE_STRINGS[ROLE_CANNIBAL] .. " dies, all eaten players are <span style='color: rgb(" .. roleColor.r .. ", " .. roleColor.g .. ", " .. roleColor.b .. ")'>freed</span> at the position where the " .. ROLE_STRINGS[ROLE_CANNIBAL] .. " died.</span>" | ||||
|
|
||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
| end | ||||
| return html | ||||
| end | ||||
| end) | ||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -49,6 +49,30 @@ table.insert(ROLE_CONVARS[ROLE_CANNIBAL], { | |||||
| cvar = "ttt_cannibal_update_scoreboard", | ||||||
| type = ROLE_CONVAR_TYPE_BOOL | ||||||
| }) | ||||||
| table.insert(ROLE_CONVARS[ROLE_CANNIBAL], { | ||||||
| cvar = "ttt_cannibal_gains_health", | ||||||
| type = ROLE_CONVAR_TYPE_BOOL | ||||||
| }) | ||||||
| table.insert(ROLE_CONVARS[ROLE_CANNIBAL], { | ||||||
| cvar = "ttt_cannibal_gained_health_percentage", | ||||||
| type = ROLE_CONVAR_TYPE_NUM | ||||||
| }) | ||||||
| table.insert(ROLE_CONVARS[ROLE_CANNIBAL], { | ||||||
| cvar = "ttt_cannibal_digests_victims", | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| type = ROLE_CONVAR_TYPE_BOOL | ||||||
| }) | ||||||
| table.insert(ROLE_CONVARS[ROLE_CANNIBAL], { | ||||||
| cvar = "ttt_cannibal_digestion_time", | ||||||
| type = ROLE_CONVAR_TYPE_NUM | ||||||
| }) | ||||||
| table.insert(ROLE_CONVARS[ROLE_CANNIBAL], { | ||||||
| cvar = "ttt_cannibal_does_poopy", | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| type = ROLE_CONVAR_TYPE_BOOL | ||||||
| }) | ||||||
| table.insert(ROLE_CONVARS[ROLE_CANNIBAL], { | ||||||
| cvar = "ttt_cannibal_does_poopy_noise", | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| type = ROLE_CONVAR_TYPE_BOOL | ||||||
| }) | ||||||
|
|
||||||
| ------------------- | ||||||
| -- ROLE FEATURES -- | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.