-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Live Dr. Breen Reaction plugin. (#114)
- Loading branch information
Showing
5 changed files
with
233 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Aspect™ | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
A joke plugin that I made on a Saturday morning because I was bored. It adds a socio-status-relevant Dr. Breen reaction to the upper-right corner of the screen that changes face poses and ambient light based on the current Socio-Status. | ||
|
||
This requires the [Combine Technology Overlay plugin](https://plugins.gethelix.co/combine-technology-overlay/) in order to function, otherwise Breen will be neutral. | ||
|
||
Note: This requires [Counter-Strike: Source](https://store.steampowered.com/app/240/CounterStrike_Source/) to be mounted for the plant model in the background. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
local ambientColors = { | ||
["GREEN"] = Color(50, 50, 50), | ||
["BLUE"] = Color(50, 50, 255), | ||
["YELLOW"] = Color(150, 150, 0), | ||
["RED"] = Color(150, 0, 0), | ||
["BLACK"] = Color(150, 0, 0) | ||
} | ||
|
||
function PLUGIN:CharacterLoaded(character) | ||
if (character:IsCombine()) then | ||
vgui.Create("ixLiveBreenReaction") | ||
elseif (IsValid(ix.gui.breenReaction)) then | ||
ix.gui.breenReaction:Remove() | ||
end | ||
end | ||
|
||
-- Override the CTO RecalculateHUDObjectives net receiver to allow us to do shit when sociostatus changes. | ||
function PLUGIN:InitializedPlugins() | ||
local CTO = ix.plugin.Get("cto") | ||
if (!CTO) then return end | ||
|
||
net.Receive("RecalculateHUDObjectives", function() | ||
local status = net.ReadString() | ||
local objectives = net.ReadTable() | ||
local lines = {} | ||
|
||
if (status) then | ||
CTO.socioStatus = status | ||
end | ||
|
||
if (objectives and objectives.text) then | ||
for k, v in pairs(string.Split(objectives.text, "\n")) do | ||
if (string.StartWith(v, "^")) then | ||
table.insert(lines, "<:: " .. string.sub(v, 2) .. " ::>") | ||
end | ||
end | ||
|
||
CTO.hudObjectives = lines | ||
end | ||
|
||
CTO:UpdateBiosignalLocations() | ||
|
||
---------- | ||
|
||
local breenReaction = ix.gui.breenReaction | ||
if (!IsValid(breenReaction)) then return end | ||
|
||
breenReaction:UpdateAmbientLight(ambientColors[status] or ambientColors["GREEN"]) | ||
end) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
|
||
local overlayMat = Material("effects/combine_binocoverlay") | ||
|
||
|
||
local PANEL = {} | ||
|
||
function PANEL:Init() | ||
if (IsValid(ix.gui.breenReaction)) then | ||
ix.gui.breenReaction:Remove() | ||
end | ||
|
||
local CTO = ix.plugin.Get("cto") | ||
|
||
self:SetSize(300, 221) | ||
self:SetPos(ScrW() - self:GetWide() - 50, 50) | ||
|
||
ix.gui.breenReaction = self | ||
|
||
local title = self:Add("DLabel") | ||
title:Dock(TOP) | ||
title:DockMargin(5, 5, 5, 5) | ||
title:SetTall(30) | ||
title:SetText("LIVE DR. BREEN REACTION") | ||
title:SetFont("ixMediumFont") | ||
title:SetTextColor(color_white) | ||
title:SetContentAlignment(5) | ||
title.Paint = function(this, width, height) | ||
surface.SetDrawColor(Color(255, 0, 0)) | ||
surface.DrawRect(0, 0, width, height) | ||
end | ||
|
||
-- Background | ||
self.barrierModelPanel = self:Add("DModelPanel") | ||
self.barrierModelPanel:Dock(FILL) | ||
self.barrierModelPanel:DockMargin(5, 0, 5, 5) | ||
self.barrierModelPanel:SetModel("models/props_combine/combine_barricade_med03b.mdl") | ||
self.barrierModelPanel:SetFOV(20) | ||
self.barrierModelPanel.Entity:SetPos(Vector(-150, -150, -25)) | ||
self.barrierModelPanel.Entity:SetAngles(Angle(0, 45, 0)) | ||
self.barrierModelPanel.LayoutEntity = function(this, entity) end | ||
|
||
-- Plant | ||
self.plantModelPanel = self.barrierModelPanel:Add("DModelPanel") | ||
self.plantModelPanel:Dock(FILL) | ||
self.plantModelPanel:SetModel("models/props/cs_office/plant01.mdl") | ||
self.plantModelPanel:SetFOV(20) | ||
self.plantModelPanel.Entity:SetPos(Vector(-80, -120, -15)) | ||
self.plantModelPanel.Entity:SetAngles(Angle(0, 40, 0)) | ||
self.plantModelPanel.LayoutEntity = function(this, entity) end | ||
|
||
-- Chair | ||
self.chairModelPanel = self.plantModelPanel:Add("DModelPanel") | ||
self.chairModelPanel:Dock(FILL) | ||
self.chairModelPanel:SetModel("models/props_combine/breenchair.mdl") | ||
self.chairModelPanel:SetFOV(20) | ||
self.chairModelPanel.Entity:SetPos(Vector(-12, -12, -17)) | ||
self.chairModelPanel.Entity:SetAngles(Angle(0, 45, 0)) | ||
self.chairModelPanel.LayoutEntity = function(this, entity) end | ||
|
||
-- The man himself | ||
self.breenModelPanel = self.chairModelPanel:Add("DModelPanel") | ||
self.breenModelPanel:Dock(FILL) | ||
self.breenModelPanel:SetModel("models/breen.mdl") | ||
self.breenModelPanel:SetFOV(20) | ||
self.breenModelPanel.Entity:SetPos(Vector(0, 0, -23)) | ||
self.breenModelPanel.Entity:SetAngles(Angle(0, 45, 0)) | ||
self.breenModelPanel.Entity:SetSequence(self.breenModelPanel.Entity:LookupSequence("idle02")) | ||
self.breenModelPanel.LayoutEntity = function(this, entity) | ||
this:RunAnimation() | ||
|
||
entity:SetFlexWeight(0, 1) -- right_lid_raiser | ||
entity:SetFlexWeight(1, 1) -- left_lid_raiser | ||
|
||
if (!CTO) then return end | ||
|
||
if (CTO.socioStatus == "GREEN") then | ||
-- HAPPY | ||
entity:SetFlexScale(1) | ||
entity:SetFlexWeight(42, 1) -- smile | ||
elseif (CTO.socioStatus == "BLUE") then | ||
-- NEUTRAL | ||
entity:SetFlexScale(1) | ||
elseif (CTO.socioStatus == "YELLOW") then | ||
-- ANNOYED | ||
entity:SetFlexScale(1.5) | ||
entity:SetFlexWeight(12, 1) -- right_outer_raiser | ||
entity:SetFlexWeight(13, 1) -- left_outer_raiser | ||
entity:SetFlexWeight(14, 1) -- right_lowerer | ||
entity:SetFlexWeight(15, 1) -- left_lowerer | ||
entity:SetFlexWeight(18, 1) -- wrinkler | ||
elseif (CTO.socioStatus == "RED") then | ||
-- ANGRY | ||
entity:SetFlexScale(1.5) | ||
entity:SetFlexWeight(12, 1) -- right_outer_raiser | ||
entity:SetFlexWeight(13, 1) -- left_outer_raiser | ||
entity:SetFlexWeight(14, 1) -- right_lowerer | ||
entity:SetFlexWeight(15, 1) -- left_lowerer | ||
entity:SetFlexWeight(18, 1) -- wrinkler | ||
entity:SetFlexWeight(35, 1) -- bite | ||
entity:SetFlexWeight(38, 1) -- jaw_clencher | ||
elseif (CTO.socioStatus == "BLACK") then | ||
-- VERY ANGRY | ||
entity:SetFlexScale(2) | ||
entity:SetFlexWeight(12, 1) -- right_outer_raiser | ||
entity:SetFlexWeight(13, 1) -- left_outer_raiser | ||
entity:SetFlexWeight(14, 1) -- right_lowerer | ||
entity:SetFlexWeight(15, 1) -- left_lowerer | ||
entity:SetFlexWeight(18, 1) -- wrinkler | ||
entity:SetFlexWeight(35, 1) -- bite | ||
entity:SetFlexWeight(38, 1) -- jaw_clencher | ||
entity:SetFlexWeight(39, 1) -- jaw_clencher | ||
end | ||
end | ||
|
||
-- make breen look up | ||
self.breenModelPanel.Entity:SetPoseParameter("head_pitch", -10) | ||
|
||
-- make breen's eyes look at the camera | ||
self.breenModelPanel.Entity:SetEyeTarget(Vector(100, 100, 30)) | ||
|
||
-- make breen blink | ||
self:CreateBlinkTimer() | ||
end | ||
|
||
function PANEL:CreateBlinkTimer() | ||
timer.Simple(math.random(1, 10), function() | ||
if (!IsValid(self.breenModelPanel) or !IsValid(self.breenModelPanel.Entity)) then | ||
timer.Remove("ixLiveBreenReactionBlink") | ||
|
||
return | ||
end | ||
|
||
self.breenModelPanel.Entity:SetFlexWeight(9, 1) -- blink | ||
|
||
self:CreateBlinkTimer(self.breenModelPanel) | ||
end) | ||
end | ||
|
||
function PANEL:UpdateAmbientLight(lightColor) | ||
self.barrierModelPanel:SetAmbientLight(lightColor) | ||
self.plantModelPanel:SetAmbientLight(lightColor) | ||
self.chairModelPanel:SetAmbientLight(lightColor) | ||
self.breenModelPanel:SetAmbientLight(lightColor) | ||
end | ||
|
||
function PANEL:Paint(width, height) | ||
surface.SetDrawColor(color_white) | ||
surface.DrawRect(0, 0, width, height) | ||
end | ||
|
||
function PANEL:PaintOver(width, height) | ||
surface.SetDrawColor(color_white) | ||
surface.SetMaterial(overlayMat) | ||
surface.DrawTexturedRect(0, 0, width, height) | ||
end | ||
|
||
vgui.Register("ixLiveBreenReaction", PANEL, "DPanel") | ||
|
||
if (IsValid(ix.gui.breenReaction)) then | ||
vgui.Create("ixLiveBreenReaction") | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
PLUGIN.name = "Live Breen Reaction" | ||
PLUGIN.author = "Aspect™" | ||
PLUGIN.description = "A joke plugin that adds a socio-status-relevant Dr. Breen reaction to the upper-right corner of the screen." | ||
|
||
ix.util.Include("cl_hooks.lua") |