Skip to content

Commit

Permalink
[FEATURE] Add SCP-500
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMarrant committed Dec 6, 2024
1 parent 7ce2e86 commit cb82682
Show file tree
Hide file tree
Showing 17 changed files with 168 additions and 1 deletion.
78 changes: 78 additions & 0 deletions lua/entities/scp_500_box/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
-- SCP-1025, A representation of a paranormal object on a fictional series on the game Garry's Mod.
-- Copyright (C) 2024 MrMarrant aka BIBI.
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.

AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel(SCP_1025_CONFIG.Models.Pill)
self:RebuildPhysics()
self:InitVar()
self.Delay = CurTime()
end

-- Initialise the physic of the entity
function ENT:RebuildPhysics()
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:PhysWake()
end

-- Use specially for the physics sounds
function ENT:PhysicsCollide( data, physobj )
if data.DeltaTime > 0.2 then
if data.Speed > 250 then
self:EmitSound("physics/plastic/plastic_box_impact_hard" .. math.random(1, 4) .. ".wav", 75, math.random( 100, 110 ))
else
self:EmitSound("physics/plastic/plastic_box_impact_soft" .. math.random(1, 4) .. ".wav", 75, math.random( 100, 110 ))
end
end
end

function ENT:Consume(ply)
if (not IsValid(ply)) then return end
local cur = CurTime()
if (self.Delay > cur ) then return end
self.Delay = cur + SCP_1025_CONFIG.Settings.DelayGlycemiaReader
local count_pills = self:GetRemainingPills()

scp_1025.ClearDiseases(ply)
count_pills = count_pills - 1
self:SetRemainingPills(count_pills)
if (count_pills <= 0) then
self:EmitSound("physics/plastic/plastic_box_break" .. math.random(1, 2) .. ".wav", 75, math.random( 100, 110 ))
self:Remove()
end
ply:ChatPrint(scp_1025.GetTranslation("consume_scp500"))
ply:ChatPrint(scp_1025.GetTranslation("remaining_pills") .. count_pills)
end

function ENT:Use(ply)
if (not IsValid(ply)) then return end

self:Consume(ply)
end

function ENT:Touch(ent)
if (not IsValid(ent)) then return end
if (not ent:IsPlayer()) then return end
if (not ent.scp_1025_IsSleeping) then return end

self:Consume(ent)
end

-- Intialise every var related to the entity
function ENT:InitVar( )
self:SetRemainingPills(SCP_1025_CONFIG.Settings.PillsNumber)
end
27 changes: 27 additions & 0 deletions lua/entities/scp_500_box/shared.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-- SCP-1025, A representation of a paranormal object on a fictional series on the game Garry's Mod.
-- Copyright (C) 2024 MrMarrant aka BIBI.

-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.

-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.

-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.

ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.Author = "MrMarrant"
ENT.PrintName = "SCP-500 Box"
ENT.Spawnable = true
ENT.Category = "SCP"

-- Set up every var related to the entity we will use
function ENT:SetupDataTables()
self:NetworkVar("Int", 0, "RemainingPills")
end
5 changes: 4 additions & 1 deletion lua/scp_1025/config/sh_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ SCP_1025_CONFIG.Models.Insulin = "models/scp_1025/insulin/insulin.mdl"
SCP_1025_CONFIG.Models.GlycemiaReader = "models/scp_1025/insulin_reader/insulin_reader.mdl"
SCP_1025_CONFIG.Models.Writer = "models/scp_1025/writer/writer.mdl"
SCP_1025_CONFIG.Models.Inhalator = "models/scp_1025/inhaler/inhaler.mdl"
SCP_1025_CONFIG.Models.Pill = "models/scp_1025/pills/pills.mdl"

--Sound Path
SCP_1025_CONFIG.Sounds = {}
Expand Down Expand Up @@ -236,8 +237,10 @@ SCP_1025_CONFIG.Settings.ParanoidColors = {
[ "$pp_colour_mulg" ] = 0,
[ "$pp_colour_mulb" ] = 0
}
-- SCP-500 Settings
SCP_1025_CONFIG.Settings.PillsNumber = 47


-- TODO : Ajouter au système de traduction
-- Default Diseases
SCP_1025_CONFIG.DiseaseAvailable = {
common_cold = {
Expand Down
4 changes: 4 additions & 0 deletions lua/scp_1025/language/sh_en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ local LANG_EN = {

-- Other
chromium = "You are using the base branch version.\nI strongly recommend using the chromium branch x86-64 version\ninstead for better stability for SCP-1025.",

-- SCP-500
consume_scp500 = "You have consumed SCP-500, you feel better, like never before.",
remaining_pills = "Remaining pills : ",
}

scp_1025.AddLanguage("en", LANG_EN)
4 changes: 4 additions & 0 deletions lua/scp_1025/language/sh_fr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ local LANG_FR = {

-- Other
chromium = "Je vous recommende vivement d'utiliser plutot la branche\nchromium x86-64 pour une meilleur stabilité de SCP-1025",

-- SCP-500
consume_scp500 = "Vous avez consommé SCP-500, vous vous sentez mieux, comme jamais auparavant.",
remaining_pills = "Pilules restantes : ",
}

scp_1025.AddLanguage("fr", LANG_FR)
Binary file added materials/entities/scp_500_box.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions materials/scp_1025/pills/m_pills_01.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"VertexlitGeneric"
{
$basetexture "scp_1025/pills/m_pills_01"
$phong "1"
$phongboost "5"
$phongfresnelranges "[.78 .9 1]"

$normalmapalphaenvmapmask "1"
$envmapfresnel "1"

$rimlight "1"
$rimmask "1"
$rimlightboost "1"
$rimlightexponent "2"

$envmaptintmult "[.25 .25 .25]"
}
Binary file added materials/scp_1025/pills/m_pills_01.vtf
Binary file not shown.
17 changes: 17 additions & 0 deletions materials/scp_1025/pills/m_pills_02.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"VertexlitGeneric"
{
$basetexture "scp_1025/pills/m_pills_02"
$phong "1"
$phongboost "5"
$phongfresnelranges "[.78 .9 1]"

$normalmapalphaenvmapmask "1"
$envmapfresnel "1"

$rimlight "1"
$rimmask "1"
$rimlightboost "1"
$rimlightexponent "2"

$envmaptintmult "[.25 .25 .25]"
}
Binary file added materials/scp_1025/pills/m_pills_02.vtf
Binary file not shown.
17 changes: 17 additions & 0 deletions materials/scp_1025/pills/m_pills_03.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"VertexlitGeneric"
{
$basetexture "scp_1025/pills/m_pills_03"
$phong "1"
$phongboost "5"
$phongfresnelranges "[.78 .9 1]"

$normalmapalphaenvmapmask "1"
$envmapfresnel "1"

$rimlight "1"
$rimmask "1"
$rimlightboost "1"
$rimlightexponent "2"

$envmaptintmult "[.25 .25 .25]"
}
Binary file added materials/scp_1025/pills/m_pills_03.vtf
Binary file not shown.
Binary file added models/scp_1025/pills/pills.dx80.vtx
Binary file not shown.
Binary file added models/scp_1025/pills/pills.dx90.vtx
Binary file not shown.
Binary file added models/scp_1025/pills/pills.mdl
Binary file not shown.
Binary file added models/scp_1025/pills/pills.phy
Binary file not shown.
Binary file added models/scp_1025/pills/pills.vvd
Binary file not shown.

0 comments on commit cb82682

Please sign in to comment.