Initial Commit
17
.gitignore
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# vscode
|
||||||
|
.vscode/*
|
||||||
|
.history
|
||||||
|
|
||||||
|
# swap
|
||||||
|
[._]*.s[a-v][a-z]
|
||||||
|
[._]*.sw[a-p]
|
||||||
|
[._]s[a-v][a-z]
|
||||||
|
[._]sw[a-p]
|
||||||
|
|
||||||
|
# session
|
||||||
|
Session.vim
|
||||||
|
|
||||||
|
# temporary
|
||||||
|
.netrwhist
|
||||||
|
*~
|
||||||
|
|
||||||
113
README.md
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
# JailBreak++
|
||||||
|
|
||||||
|
An enhanced version of Jailbreak 7, originally developed by casualbananas, for SpergNation.com Jailbreak
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
The following convars can be put in your `./cfg/server.cfg` file.
|
||||||
|
It is recommended to not put convars in your config file unless you know exactly what the effect is the convar is. Invalid values may break the gamemode.
|
||||||
|
|
||||||
|
Convar | Effect
|
||||||
|
-------------------------------------------|----------------------------------------------------------------------------------
|
||||||
|
`jb_config_debug 1/0` | Debug mode, you might want to set this to 0 to reduce annoying console messages
|
||||||
|
`jb_config_font Roboto` | The gamemode's font. I disrecommend changing this; may cause everything to go weird!
|
||||||
|
`jb_config_website example.com` | The URL of your website. This URL will be displayed as a form of advertising your site.
|
||||||
|
`jb_config_jointime 20` [minimum: 10] | (seconds) period when the map just loaded and people are given a chance to join.
|
||||||
|
`jb_config_setuptime 60` [minimum: 10] | (seconds) period at the start of the round when guards may claim warden.
|
||||||
|
`jb_config_guards_allowed 30` [minimum: 1] | Percentage of players allowed to be guard
|
||||||
|
`jb_config_guards_playtime 120` | (minutes) playtime required to be guard (admins bypass this)
|
||||||
|
`jb_config_rebel_sensitivity 0-2` | 2 = prisoner becomes rebel on killing a guard, 1 = prisoner becomes rebel on damaging a guard, 0 = prisoner never becomes rebel.
|
||||||
|
`jb_config_prisoners_namechange 1/0` | 1 = use fake names for prisoners (ex. Prisoner 192346), 0 = use normal nicknames for prisoners
|
||||||
|
`jb_config_warden_control_enabled 1/0` | Toggles whether warden control should be enabled or not. (recommended: always 1);
|
||||||
|
`jb_config_prisoner_special_chance 8` | Chance a prisoner will get a random weapon. Chance = random(1,var)==1;
|
||||||
|
`jb_config_max_warden_rounds 3` | Maximum amount of rounds a player can be warden in a row.
|
||||||
|
`jb_config_knives_are_concealed 1` | Conceal knives - they won't draw on the player's tigh if this is set to 1.
|
||||||
|
`jb_config_rounds_per_map 10` | Rounds until mapvote - ONLY SET THIS IF YOU HAVE A MAPVOTE SYSTEM ON YOUR SERVER/COMMUNITY
|
||||||
|
`jb_config_notify_lastguard 1/0` | Send the "last guard kills all" notification
|
||||||
|
|
||||||
|
## Developers
|
||||||
|
|
||||||
|
### Last requests
|
||||||
|
This is how last requests are added. LR files have to put put in the lastrequests folder.
|
||||||
|
```lua
|
||||||
|
|
||||||
|
-- Initialize a new LR class
|
||||||
|
local LR = JB.CLASS_LR();
|
||||||
|
|
||||||
|
-- Give it a name and description
|
||||||
|
LR:SetName("Knife Battle");
|
||||||
|
LR:SetDescription("The guard and the prisoner both get a knife, all other weapons are stripped, and they must fight eachother until one of the two dies");
|
||||||
|
|
||||||
|
-- Give it an Icon for in the LR-menu
|
||||||
|
LR:SetIcon(Material("icon16/flag_blue.png"))
|
||||||
|
|
||||||
|
-- Setup what happens after somebody picks this Last Request
|
||||||
|
LR:SetStartCallback(function(prisoner,guard)
|
||||||
|
for _,ply in ipairs{prisoner,guard} do
|
||||||
|
ply:StripWeapons();
|
||||||
|
ply:Give("weapon_jb_knife");
|
||||||
|
ply:Give("weapon_jb_fists");
|
||||||
|
|
||||||
|
ply:SetHealth(100);
|
||||||
|
ply:SetArmor(0);
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Tell JailBreak that this LR is ready for use.
|
||||||
|
LR();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Hooks
|
||||||
|
|
||||||
|
These are all custom hooks called by the gamemode.
|
||||||
|
Format: `hookname ( arguments[, optional argument] )`
|
||||||
|
|
||||||
|
```lua
|
||||||
|
-- JailBreakRoundStart
|
||||||
|
-- Called when the round starts
|
||||||
|
JailBreakRoundStart ( rounds_passed )
|
||||||
|
|
||||||
|
-- JailBreakRoundEnd
|
||||||
|
-- Called when the round ends
|
||||||
|
JailBreakRoundEnd ( rounds_passed )
|
||||||
|
|
||||||
|
-- JailBreakPlayerSwitchTeam
|
||||||
|
-- Called on team switch
|
||||||
|
JailBreakPlayerSwitchTeam ( player, team )
|
||||||
|
|
||||||
|
-- JailBreakStartMapvote
|
||||||
|
-- Called when a mapvote should be started.
|
||||||
|
-- return true: Use custom mapvote system, return false: Use default system (normally; no mapvote).
|
||||||
|
JailBreakStartMapvote ( rounds_passed, extentions_passed )
|
||||||
|
|
||||||
|
-- JailBreakClaimWarden
|
||||||
|
-- Called when somebody claims warden
|
||||||
|
JailBreakClaimWarden ( player, warden_rounds_in_a_row )
|
||||||
|
|
||||||
|
-- JailBreakWardenControlChanged
|
||||||
|
-- Called when a warden control is changed
|
||||||
|
JailBreakWardenControlChanged ( player, option, value )
|
||||||
|
|
||||||
|
-- JailBreakWardenSpawnProp
|
||||||
|
-- Called when the warden spawns a prop
|
||||||
|
JailBreakWardenSpawnProp ( player, type[, model] )
|
||||||
|
|
||||||
|
-- JailBreakWardenPlacePointer
|
||||||
|
-- Called when a pointer is placed
|
||||||
|
JailBreakWardenPlacePointer ( player, type, position )
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Implement a hook using the `hook.Add` function, example:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
hook.Add("JailBreakRoundStart","JB.Examples.RoundStart",function(rounds_passed)
|
||||||
|
if rounds_passed > 5 then
|
||||||
|
print "We are past round 5. Let's kill everyone!";
|
||||||
|
|
||||||
|
for _,ply in ipairs( player.GetAll() ) do
|
||||||
|
ply:Kill();
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end);
|
||||||
|
```
|
||||||
BIN
content/materials/jailbreak_excl/button.psd
Normal file
BIN
content/materials/jailbreak_excl/button_edge.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
content/materials/jailbreak_excl/button_middle.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
content/materials/jailbreak_excl/crosshair.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
content/materials/jailbreak_excl/crosshair.psd
Normal file
BIN
content/materials/jailbreak_excl/gradient.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
content/materials/jailbreak_excl/guide/slide.psd
Normal file
BIN
content/materials/jailbreak_excl/guide/slide_1.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
content/materials/jailbreak_excl/guide/slide_2.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
content/materials/jailbreak_excl/guide/slide_3.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
content/materials/jailbreak_excl/guide/slide_4.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
content/materials/jailbreak_excl/hud_health.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
content/materials/jailbreak_excl/hud_health.psd
Normal file
BIN
content/materials/jailbreak_excl/hud_health_bottom.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
content/materials/jailbreak_excl/hud_restricted.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
content/materials/jailbreak_excl/hud_time.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
content/materials/jailbreak_excl/hud_time.psd
Normal file
BIN
content/materials/jailbreak_excl/hud_warden.psd
Normal file
BIN
content/materials/jailbreak_excl/hud_warden_bar.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
content/materials/jailbreak_excl/lastrequest.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
content/materials/jailbreak_excl/lastrequest.psd
Normal file
BIN
content/materials/jailbreak_excl/logo_guard.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
content/materials/jailbreak_excl/logo_guard.psd
Normal file
BIN
content/materials/jailbreak_excl/logo_prisoner.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
content/materials/jailbreak_excl/logo_prisoner.psd
Normal file
BIN
content/materials/jailbreak_excl/notify_bracket.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
content/materials/jailbreak_excl/notify_bracket.psd
Normal file
BIN
content/materials/jailbreak_excl/notify_quick.psd
Normal file
BIN
content/materials/jailbreak_excl/notify_quick_edge.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
content/materials/jailbreak_excl/notify_quick_middle.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
content/materials/jailbreak_excl/pointers/cross.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
content/materials/jailbreak_excl/pointers/exclamation.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
content/materials/jailbreak_excl/pointers/generic.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
content/materials/jailbreak_excl/pointers/line.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
content/materials/jailbreak_excl/pointers/pointer.psd
Normal file
BIN
content/materials/jailbreak_excl/pointers/pointer_background.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
content/materials/jailbreak_excl/pointers/pointer_background.psd
Normal file
BIN
content/materials/jailbreak_excl/pointers/question.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
content/materials/jailbreak_excl/scope.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
content/materials/jailbreak_excl/scope.psd
Normal file
BIN
content/materials/jailbreak_excl/scoreboard_avatar.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
content/materials/jailbreak_excl/scoreboard_avatar.psd
Normal file
BIN
content/materials/jailbreak_excl/scoreboard_bottom.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
content/materials/jailbreak_excl/scoreboard_bottom_edge.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
content/materials/jailbreak_excl/scoreboard_edge.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
content/materials/jailbreak_excl/scoreboard_middle.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
content/materials/jailbreak_excl/vgui_close.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
content/materials/jailbreak_excl/vgui_close.psd
Normal file
BIN
content/materials/jailbreak_excl/vgui_close_hover.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
content/materials/jailbreak_excl/weapon_selection_tile.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
72
entities/entities/jb_ammobox.lua
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
AddCSLuaFile();
|
||||||
|
|
||||||
|
ENT.Type = "anim"
|
||||||
|
ENT.Base = "base_anim"
|
||||||
|
|
||||||
|
function ENT:Initialize()
|
||||||
|
if SERVER then
|
||||||
|
self:SetModel( "models/Items/item_item_crate.mdl" );
|
||||||
|
|
||||||
|
self:SetUseType(SIMPLE_USE);
|
||||||
|
self:PhysicsInit( SOLID_VPHYSICS )
|
||||||
|
self:SetMoveType(MOVETYPE_VPHYSICS);
|
||||||
|
self:SetSolid(SOLID_VPHYSICS);
|
||||||
|
|
||||||
|
local phys = self:GetPhysicsObject()
|
||||||
|
if ( IsValid( phys ) ) then
|
||||||
|
phys:Wake()
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function ENT:Use(p)
|
||||||
|
if IsValid(p) and (not p.nextAmmoCrate or p.nextAmmoCrate < CurTime()) then
|
||||||
|
p.nextAmmoCrate = CurTime() + 5;
|
||||||
|
|
||||||
|
p:GiveAmmo(128,"SMG1");
|
||||||
|
p:GiveAmmo(128,"Pistol");
|
||||||
|
|
||||||
|
p:SendNotification("You picked up an ammo crate");
|
||||||
|
|
||||||
|
self:Remove();
|
||||||
|
elseif IsValid(p) then
|
||||||
|
p:SendQuickNotification("You already picked up an ammo crate!");
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function ENT:Draw()
|
||||||
|
self:DrawModel();
|
||||||
|
end
|
||||||
85
entities/entities/jb_transmitter_state.lua
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
AddCSLuaFile();
|
||||||
|
|
||||||
|
ENT.Base ="base_point"
|
||||||
|
ENT.Type ="point"
|
||||||
|
ENT.PrintName ="JB State Transmitter"
|
||||||
|
|
||||||
|
function ENT:Initialize()
|
||||||
|
JB.TRANSMITTER = self;
|
||||||
|
JB:DebugPrint("Setup State Transmitter!");
|
||||||
|
//self:SetPredictable(true);
|
||||||
|
end
|
||||||
|
function ENT:Think()
|
||||||
|
if not IsValid(JB.TRANSMITTER) and IsValid(self) then // there is no registered transmitter and yet we're here. What's going on? Let's assume that we are the transmitter that is being looked for.
|
||||||
|
JB.TRANSMITTER = self;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function ENT:SetupDataTables()
|
||||||
|
self:NetworkVar( "Int", 0, "JBState" );
|
||||||
|
self:NetworkVar( "Int", 1, "JBRoundsPassed" );
|
||||||
|
|
||||||
|
self:NetworkVar( "Vector", 0, "JBWarden_PointerPos")
|
||||||
|
|
||||||
|
self:NetworkVar( "String", 0, "JBLastRequestPicked" );
|
||||||
|
self:NetworkVar( "String", 1, "JBWarden_PointerType");
|
||||||
|
|
||||||
|
self:NetworkVar( "Float", 0, "JBRoundStartTime" );
|
||||||
|
|
||||||
|
self:NetworkVar( "Entity", 0, "JBLastRequestPrisoner" );
|
||||||
|
self:NetworkVar( "Entity", 1, "JBLastRequestGuard" );
|
||||||
|
self:NetworkVar( "Entity", 2, "JBWarden" );
|
||||||
|
|
||||||
|
self:NetworkVar ( "Bool", 0, "JBWarden_PVPDamage");
|
||||||
|
self:NetworkVar ( "Bool", 1, "JBWarden_ItemPickup");
|
||||||
|
|
||||||
|
if ( SERVER ) then
|
||||||
|
self:SetJBRoundStartTime(0);
|
||||||
|
self:SetJBState(STATE_IDLE);
|
||||||
|
self:SetJBRoundsPassed(0);
|
||||||
|
self:SetJBWarden_PointerType("0");
|
||||||
|
self:SetJBWarden_PointerPos(Vector(0,0,0));
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function ENT:UpdateTransmitState()
|
||||||
|
return TRANSMIT_ALWAYS;
|
||||||
|
end
|
||||||
|
function ENT:KeyValue( key, value )
|
||||||
|
if ( self:SetNetworkKeyValue( key, value ) ) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function ENT:CanEditVariables( ply )
|
||||||
|
return false;
|
||||||
|
end
|
||||||
131
entities/entities/jb_zone.lua
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
ENT.Type = "anim"
|
||||||
|
ENT.Base = "base_anim"
|
||||||
|
|
||||||
|
if SERVER then
|
||||||
|
|
||||||
|
function ENT:Initialize()
|
||||||
|
self:SetModel( "models/hunter/blocks/cube025x025x025.mdl" )
|
||||||
|
|
||||||
|
local min = self.min or Vector(-100,-50,-100)
|
||||||
|
local max = self.max or Vector(100,100,100)
|
||||||
|
|
||||||
|
self:SetMoveType(MOVETYPE_NONE)
|
||||||
|
self:SetCollisionGroup( COLLISION_GROUP_IN_VEHICLE )
|
||||||
|
|
||||||
|
self:SetTrigger(true)
|
||||||
|
|
||||||
|
self:PhysicsInitBox(min,max)
|
||||||
|
self:SetCollisionBounds(min,max)
|
||||||
|
|
||||||
|
local phys = self:GetPhysicsObject()
|
||||||
|
if phys and phys:IsValid() then
|
||||||
|
phys:Wake()
|
||||||
|
phys:EnableMotion(false)
|
||||||
|
phys:EnableGravity( false )
|
||||||
|
phys:EnableDrag( false )
|
||||||
|
end
|
||||||
|
|
||||||
|
self.handle_min=ents.Create("jb_zone_handle")
|
||||||
|
self.handle_min:SetPos(self:GetPos()+min)
|
||||||
|
self.handle_min:SetZoneEntity(self)
|
||||||
|
self.handle_min:Spawn()
|
||||||
|
|
||||||
|
self.handle_max=ents.Create("jb_zone_handle")
|
||||||
|
self.handle_max:SetPos(self:GetPos()+max)
|
||||||
|
self.handle_max:SetZoneEntity(self)
|
||||||
|
self.handle_max:Spawn()
|
||||||
|
|
||||||
|
self.lastMin=self.handle_min:GetPos()
|
||||||
|
self.lastMax=self.handle_max:GetPos()
|
||||||
|
end
|
||||||
|
|
||||||
|
local noReward={}
|
||||||
|
function ENT:StartTouch( ply )
|
||||||
|
if IsValid(ply) and ply:IsPlayer() and ply.GetInGuardZone then
|
||||||
|
if not ply:GetInGuardZone() then
|
||||||
|
ply:SendQuickNotification("You entered a guard-only zone.")
|
||||||
|
end
|
||||||
|
ply:SetInGuardZone(true)
|
||||||
|
|
||||||
|
if not ply._guardZones then
|
||||||
|
ply._guardZones={}
|
||||||
|
end
|
||||||
|
|
||||||
|
ply._guardZones[self:EntIndex()]=true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function ENT:EndTouch( ply )
|
||||||
|
if IsValid(ply) and ply:IsPlayer() and ply._guardZones and ply.GetInGuardZone then
|
||||||
|
ply._guardZones[self:EntIndex()]=false
|
||||||
|
|
||||||
|
for k,v in pairs(ply._guardZones)do
|
||||||
|
if v then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ply:SetInGuardZone(false)
|
||||||
|
|
||||||
|
if ply:Alive() then
|
||||||
|
ply:SendQuickNotification("You left a guard-only zone.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local a0=Angle(0,0,0)
|
||||||
|
local p0=Vector(0,0,0)
|
||||||
|
function ENT:Think()
|
||||||
|
if self:GetAngles() ~= a0 or self:GetPos() ~= p0 then
|
||||||
|
self:SetAngles(a0)
|
||||||
|
self:SetPos(p0)
|
||||||
|
|
||||||
|
local phys = self:GetPhysicsObject()
|
||||||
|
if phys and phys:IsValid() then
|
||||||
|
phys:Wake()
|
||||||
|
phys:EnableMotion(false)
|
||||||
|
phys:EnableGravity( false )
|
||||||
|
phys:EnableDrag( false )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if IsValid(self.handle_min) and IsValid(self.handle_max) and (self.lastMin ~= self.handle_min:GetPos() or self.lastMax ~= self.handle_max:GetPos()) then
|
||||||
|
self:Resize(self.handle_min:GetPos(),self.handle_max:GetPos())
|
||||||
|
self.lastMin=self.handle_min:GetPos()
|
||||||
|
self.lastMax=self.handle_max:GetPos()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function ENT:Resize(minWorld,maxWorld)
|
||||||
|
local min = self:WorldToLocal( minWorld )
|
||||||
|
local max = self:WorldToLocal( maxWorld )
|
||||||
|
|
||||||
|
self:PhysicsInitBox(min,max)
|
||||||
|
self:SetCollisionBounds(min,max)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ENT:UpdateTransmitState()
|
||||||
|
return TRANSMIT_ALWAYS
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif CLIENT then
|
||||||
|
function ENT:Think()
|
||||||
|
local mins,maxs=self:OBBMins(),self:OBBMaxs();
|
||||||
|
self:SetRenderBoundsWS( mins,maxs )
|
||||||
|
end
|
||||||
|
local tx=Material( "color" )
|
||||||
|
function ENT:Draw()
|
||||||
|
local ply = LocalPlayer()
|
||||||
|
local wep = ply:GetActiveWeapon()
|
||||||
|
|
||||||
|
if not IsValid(ply) or not IsValid(wep) or wep:GetClass()~="weapon_physgun" then return end
|
||||||
|
|
||||||
|
local mins,maxs=self:OBBMins(),self:OBBMaxs();
|
||||||
|
|
||||||
|
render.SetMaterial( tx )
|
||||||
|
render.DrawBox( self:GetPos(),self:GetAngles(),mins,maxs,JB.Color["#FF4411AA"],true)
|
||||||
|
render.DrawWireframeBox( self:GetPos(),self:GetAngles(),mins,maxs,JB.Color["#FFCCAAFF"],true)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
77
entities/entities/jb_zone_handle.lua
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
ENT.Type = "anim"
|
||||||
|
ENT.Base = "base_anim"
|
||||||
|
|
||||||
|
function ENT:SetupDataTables()
|
||||||
|
self:NetworkVar( "Entity", 0, "ZoneEntity" )
|
||||||
|
end
|
||||||
|
|
||||||
|
function ENT:Initialize()
|
||||||
|
|
||||||
|
local Radius = 5
|
||||||
|
|
||||||
|
if ( SERVER ) then
|
||||||
|
|
||||||
|
self:SetModel( "models/props_junk/watermelon01.mdl" )
|
||||||
|
|
||||||
|
local min = Vector( 1, 1, 1 ) * Radius * -0.5
|
||||||
|
local max = Vector( 1, 1, 1 ) * Radius * 0.5
|
||||||
|
|
||||||
|
self:PhysicsInitBox( min, max )
|
||||||
|
|
||||||
|
local phys = self:GetPhysicsObject()
|
||||||
|
if ( IsValid( phys) ) then
|
||||||
|
|
||||||
|
phys:Wake()
|
||||||
|
phys:EnableGravity( false )
|
||||||
|
phys:EnableDrag( false )
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
self:SetCollisionBounds( min, max )
|
||||||
|
self:DrawShadow( false )
|
||||||
|
self:SetCollisionGroup( COLLISION_GROUP_WEAPON )
|
||||||
|
|
||||||
|
self.isPositioned=false
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
self.GripMaterial = Material( "sprites/grip" )
|
||||||
|
self:SetCollisionBounds( Vector( -Radius, -Radius, -Radius ), Vector( Radius, Radius, Radius ) )
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function ENT:Draw()
|
||||||
|
|
||||||
|
local ply = LocalPlayer()
|
||||||
|
local wep = ply:GetActiveWeapon()
|
||||||
|
|
||||||
|
if ( !IsValid( wep ) ) then return end
|
||||||
|
|
||||||
|
local weapon_name = wep:GetClass()
|
||||||
|
|
||||||
|
if ( weapon_name ~= "weapon_physgun" ) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
render.SetMaterial( self.GripMaterial )
|
||||||
|
render.DrawSprite( self:GetPos(), 16, 16, color_white )
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function ENT:PhysicsUpdate( physobj )
|
||||||
|
|
||||||
|
if ( CLIENT ) then return end
|
||||||
|
|
||||||
|
if ( !self:IsPlayerHolding() and !self:IsConstrained() ) then
|
||||||
|
|
||||||
|
physobj:SetVelocity( Vector(0,0,0) )
|
||||||
|
physobj:Sleep()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
69
entities/weapons/weapon_jb_ak47.lua
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
SWEP.PrintName = "AK-47"
|
||||||
|
|
||||||
|
SWEP.Slot = 1
|
||||||
|
SWEP.SlotPos = 1
|
||||||
|
|
||||||
|
SWEP.HoldType = "ar2"
|
||||||
|
SWEP.Base = "weapon_jb_base"
|
||||||
|
|
||||||
|
SWEP.Spawnable = true
|
||||||
|
SWEP.AdminSpawnable = true
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_rif_ak47.mdl"
|
||||||
|
SWEP.WorldModel = "models/weapons/w_rif_ak47.mdl"
|
||||||
|
|
||||||
|
SWEP.Weight = 3
|
||||||
|
SWEP.AutoSwitchTo = true
|
||||||
|
SWEP.AutoSwitchFrom = false
|
||||||
|
|
||||||
|
SWEP.Primary.Sound = Sound("Weapon_AK47.Single")
|
||||||
|
SWEP.Primary.Recoil = 1
|
||||||
|
SWEP.Primary.Damage = 32
|
||||||
|
SWEP.Primary.NumShots = 1
|
||||||
|
SWEP.Primary.Cone = 0.026
|
||||||
|
SWEP.Primary.ClipSize = 30
|
||||||
|
SWEP.Primary.Delay = 0.14
|
||||||
|
SWEP.Primary.DefaultClip = 60
|
||||||
|
SWEP.Primary.Automatic = true
|
||||||
|
SWEP.Primary.Ammo = "smg1"
|
||||||
|
SWEP.ReloadSequenceTime = 1.85;
|
||||||
|
|
||||||
|
SWEP.Positions = {};
|
||||||
|
SWEP.Positions[1] = {pos = Vector(0,0,0), ang = Vector(0,0,0)};
|
||||||
|
SWEP.Positions[2] = {pos = Vector(-6.56, -10.08, 2.519), ang = Vector(2.4, 0.1, 0)};
|
||||||
|
SWEP.Positions[3] = {pos = Vector(6.534, -15.827, -5.277), ang = Vector(-3.58, 66.97, -26.733)};
|
||||||
66
entities/weapons/weapon_jb_aug.lua
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
SWEP.PrintName = "AUG"
|
||||||
|
SWEP.Slot = 1
|
||||||
|
SWEP.SlotPos = 1
|
||||||
|
|
||||||
|
SWEP.HoldType = "ar2"
|
||||||
|
SWEP.Base = "weapon_jb_base"
|
||||||
|
SWEP.Category = "Jailbreak Weapons"
|
||||||
|
|
||||||
|
SWEP.Spawnable = true
|
||||||
|
SWEP.AdminSpawnable = true
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_rif_aug.mdl"
|
||||||
|
SWEP.WorldModel = "models/weapons/w_rif_aug.mdl"
|
||||||
|
|
||||||
|
SWEP.Weight = 5
|
||||||
|
SWEP.AutoSwitchTo = true
|
||||||
|
SWEP.AutoSwitchFrom = false
|
||||||
|
|
||||||
|
SWEP.Primary.Sound = Sound( "Weapon_Aug.Single" )
|
||||||
|
SWEP.Primary.Recoil = 0.5
|
||||||
|
SWEP.Primary.Damage = 22
|
||||||
|
SWEP.Primary.NumShots = 1
|
||||||
|
SWEP.Primary.Cone = 0.07
|
||||||
|
SWEP.Primary.ClipSize = 30
|
||||||
|
SWEP.Primary.Delay = 0.12
|
||||||
|
SWEP.Primary.DefaultClip = 90
|
||||||
|
SWEP.Primary.Automatic = true
|
||||||
|
SWEP.Primary.Ammo = "smg1"
|
||||||
|
|
||||||
|
SWEP.Positions = {};
|
||||||
|
SWEP.Positions[1] = {pos = Vector(0,0,0), ang = Vector(0,0,0)};
|
||||||
|
SWEP.Positions[2] = {pos = Vector(-8.12, -7.441, 1.32), ang = Vector(1.1, -3, -9.301)};
|
||||||
|
SWEP.Positions[3] = {pos = Vector(5.276, -11.891, -1.655), ang = Vector(-19.567, 63.11, -35.551)};
|
||||||
110
entities/weapons/weapon_jb_awp.lua
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
SWEP.PrintName = "AWP Sniper Rifle"
|
||||||
|
|
||||||
|
SWEP.Slot = 1
|
||||||
|
SWEP.SlotPos = 1
|
||||||
|
|
||||||
|
SWEP.HoldType = "ar2"
|
||||||
|
SWEP.Base = "weapon_jb_base"
|
||||||
|
|
||||||
|
SWEP.Spawnable = true
|
||||||
|
SWEP.AdminSpawnable = true
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_snip_awp.mdl"
|
||||||
|
SWEP.WorldModel = "models/weapons/w_snip_awp.mdl"
|
||||||
|
|
||||||
|
SWEP.Weight = 3
|
||||||
|
SWEP.AutoSwitchTo = true
|
||||||
|
SWEP.AutoSwitchFrom = false
|
||||||
|
|
||||||
|
SWEP.Primary.Sound = Sound("weapons/awp/awp1.wav")
|
||||||
|
SWEP.Primary.Recoil = 5
|
||||||
|
SWEP.Primary.Damage = 160
|
||||||
|
SWEP.Primary.NumShots = 1
|
||||||
|
SWEP.Primary.Cone = 0.000001
|
||||||
|
SWEP.Primary.ClipSize = 5
|
||||||
|
SWEP.Primary.Delay = 1.4
|
||||||
|
SWEP.Primary.DefaultClip = 30
|
||||||
|
SWEP.Primary.Automatic = false
|
||||||
|
SWEP.Primary.Ammo = "smg1"
|
||||||
|
|
||||||
|
SWEP.Secondary.Automatic = false
|
||||||
|
SWEP.Secondary.ClipSize = -1
|
||||||
|
SWEP.Secondary.DefaultClip = -1
|
||||||
|
|
||||||
|
|
||||||
|
SWEP.Positions = {};
|
||||||
|
SWEP.Positions[1] = {pos = Vector(0,0,0), ang = Vector(0,0,0)};
|
||||||
|
SWEP.Positions[2] = {pos = Vector(-6.761, -3.859, -12.24), ang = Vector(0,0,0)};
|
||||||
|
SWEP.Positions[3] = {pos = Vector(6.534, -14.094, 0.708), ang = Vector(0,70,0)};
|
||||||
|
|
||||||
|
function SWEP:TranslateFOV(fov)
|
||||||
|
if self:GetNWMode() == 2 then
|
||||||
|
return 10
|
||||||
|
else
|
||||||
|
return fov
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if CLIENT then
|
||||||
|
|
||||||
|
|
||||||
|
function SWEP:AdjustMouseSensitivity()
|
||||||
|
return self:GetNWMode() == 2 and .08 or 1;
|
||||||
|
end
|
||||||
|
|
||||||
|
local scopeMat = Material("jailbreak_excl/scope.png");
|
||||||
|
|
||||||
|
function SWEP:DrawHUD()
|
||||||
|
if self:GetNWMode() == 2 then
|
||||||
|
|
||||||
|
local size = ScrH();
|
||||||
|
|
||||||
|
surface.SetDrawColor(JB.Color.black)
|
||||||
|
|
||||||
|
surface.DrawRect(0, 0, (ScrW()-size) / 2, size);
|
||||||
|
surface.DrawRect(ScrW() - ((ScrW()-size) / 2), 0, (ScrW()-size) / 2, size);
|
||||||
|
|
||||||
|
surface.DrawLine(0,ScrH()/2,ScrW(),ScrH()/2)
|
||||||
|
surface.DrawLine(ScrW()/2,0,ScrW()/2,ScrH())
|
||||||
|
|
||||||
|
surface.SetDrawColor(JB.Color.black)
|
||||||
|
surface.SetMaterial(scopeMat)
|
||||||
|
surface.DrawTexturedRect( (ScrW()/2) - (size/2) , 0, size, size)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
219
entities/weapons/weapon_jb_base/client.lua
Normal file
@@ -0,0 +1,219 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
local MODE_NORMAL = 1;
|
||||||
|
local MODE_AIM = 2;
|
||||||
|
local MODE_SPRINT = 3;
|
||||||
|
|
||||||
|
SWEP.DrawAmmo = true;
|
||||||
|
SWEP.DrawCrosshair = false;
|
||||||
|
SWEP.ViewModelFOV = 52;
|
||||||
|
SWEP.ViewModelFlip = false;
|
||||||
|
SWEP.CSMuzzleFlashes = true;
|
||||||
|
SWEP.DrawWeaponInfoBox = true;
|
||||||
|
|
||||||
|
SWEP.Slot = 1;
|
||||||
|
SWEP.SlotPos = 1;
|
||||||
|
|
||||||
|
SWEP.lastFire = 0;
|
||||||
|
|
||||||
|
local matCrosshair = Material("materials/jailbreak_excl/crosshair.png");
|
||||||
|
|
||||||
|
local lastFire = 0;
|
||||||
|
function SWEP:FireCallback()
|
||||||
|
if IsFirstTimePredicted() then
|
||||||
|
local vm = self.Owner:GetViewModel();
|
||||||
|
local muz = vm:GetAttachment("1");
|
||||||
|
|
||||||
|
if not self.Em then
|
||||||
|
self.Em = ParticleEmitter(muz.Pos);
|
||||||
|
end
|
||||||
|
|
||||||
|
local par = self.Em:Add("particle/smokesprites_000" .. math.random(1, 9), muz.Pos);
|
||||||
|
par:SetStartSize(math.random(0.5, 1));
|
||||||
|
par:SetStartAlpha(100);
|
||||||
|
par:SetEndAlpha(0);
|
||||||
|
par:SetEndSize(math.random(4, 4.5));
|
||||||
|
par:SetDieTime(1 + math.Rand(-0.3, 0.3));
|
||||||
|
par:SetRoll(math.Rand(0.2, .8));
|
||||||
|
par:SetRollDelta(0.8 + math.Rand(-0.3, 0.3));
|
||||||
|
par:SetColor(140,140,140,200);
|
||||||
|
par:SetGravity(Vector(0, 0, .5));
|
||||||
|
local mup = (muz.Ang:Up()*-1);
|
||||||
|
par:SetVelocity(Vector(0, 0,7)-Vector(mup.x,mup.y,0));
|
||||||
|
|
||||||
|
local par = self.Em:Add("sprites/heatwave", muz.Pos);
|
||||||
|
par:SetStartSize(4);
|
||||||
|
par:SetEndSize(0);
|
||||||
|
par:SetDieTime(0.6);
|
||||||
|
par:SetGravity(Vector(0, 0, 1));
|
||||||
|
par:SetVelocity(Vector(0, 0, 1));
|
||||||
|
end
|
||||||
|
lastFire = CurTime();
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:AdjustMouseSensitivity()
|
||||||
|
return self:GetNWMode() == MODE_AIM and .5 or 1;
|
||||||
|
end
|
||||||
|
|
||||||
|
local gap = 5
|
||||||
|
local gap2 = 0
|
||||||
|
local color_sight = Color(255,255,255,255);
|
||||||
|
local x2 = (ScrW() - 1024) / 2
|
||||||
|
local y2 = (ScrH() - 1024) / 2
|
||||||
|
local x3 = ScrW() - x2
|
||||||
|
local y3 = ScrH() - y2
|
||||||
|
local dt;
|
||||||
|
function SWEP:DrawHUD()
|
||||||
|
dt = FrameTime();
|
||||||
|
|
||||||
|
x, y = ScrW() / 2, ScrH() / 2;
|
||||||
|
|
||||||
|
local scale = (10 * self.Primary.Cone)* (2 - math.Clamp( (CurTime() - self:GetNWLastShoot()) * 5, 0.0, 1.0 ))
|
||||||
|
|
||||||
|
if (self:GetNWMode() == MODE_AIM and not self.FakeIronSights) or self:GetNWMode() == MODE_SPRINT then
|
||||||
|
color_sight.a = math.Approach(color_sight.a, 0, dt / 0.0017)
|
||||||
|
else
|
||||||
|
color_sight.a = math.Approach(color_sight.a, 230, dt / 0.001)
|
||||||
|
end
|
||||||
|
|
||||||
|
gap = math.Approach(gap, 50 * ((10 / (self.Owner:GetFOV() / 90)) * self:GetNWLastShoot()), 1.5 + gap * 0.1)
|
||||||
|
|
||||||
|
surface.SetDrawColor(color_sight);
|
||||||
|
surface.SetMaterial(matCrosshair);
|
||||||
|
surface.DrawTexturedRectRotated(x - gap - 14/2,y,32,32,270+180);
|
||||||
|
surface.DrawTexturedRectRotated(x + gap + 14/2,y,32,32,90+180);
|
||||||
|
surface.DrawTexturedRectRotated(x, y + gap + 14/2,32,32,0+180);
|
||||||
|
surface.DrawTexturedRectRotated(x, y - gap - 14/2,32,32,180+180);
|
||||||
|
end
|
||||||
|
|
||||||
|
local time,fireTime,targetPos,targetAng,speed,speedReduced;
|
||||||
|
local idealPos = Vector(0,0,0);
|
||||||
|
function SWEP:GetViewModelPosition( pos, ang )
|
||||||
|
if not IsValid(self.Owner) then return end
|
||||||
|
|
||||||
|
local mode = self:GetNWMode();
|
||||||
|
if mode < 1 or mode > 3 then
|
||||||
|
mode = MODE_NORMAL;
|
||||||
|
end
|
||||||
|
|
||||||
|
time = math.Clamp(FrameTime() * 7,0,1);
|
||||||
|
|
||||||
|
idealPos.x = self.Positions[mode].pos.x;
|
||||||
|
idealPos.y = self.Positions[mode].pos.y;
|
||||||
|
|
||||||
|
if mode == MODE_AIM and self.FakeIronSights then
|
||||||
|
idealPos.z = self.Positions[mode].pos.z-1.4;
|
||||||
|
else
|
||||||
|
idealPos.z = self.Positions[mode].pos.z
|
||||||
|
end
|
||||||
|
|
||||||
|
self.smPos = LerpVector(time,self.smPos or self.Positions[mode].pos,idealPos);
|
||||||
|
self.smAng = LerpVector(time,self.smAng or self.Positions[mode].ang,self.Positions[mode].ang);
|
||||||
|
|
||||||
|
if !self.lastMode or mode ~= self.lastMode then
|
||||||
|
self.lastMode = mode;
|
||||||
|
|
||||||
|
if mode == MODE_AIM then
|
||||||
|
self.SwayScale = 0
|
||||||
|
self.BobScale = 0
|
||||||
|
else
|
||||||
|
self.SwayScale = 0.8
|
||||||
|
self.BobScale = 0.8
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
targetPos = self.smPos + vector_origin;
|
||||||
|
targetAng = self.smAng;
|
||||||
|
|
||||||
|
if mode == MODE_AIM then
|
||||||
|
local mul = 0;
|
||||||
|
fireTime = math.Clamp(FrameTime()*7,.05,.18);
|
||||||
|
lastFire = lastFire or 0;
|
||||||
|
if lastFire > CurTime() - fireTime then
|
||||||
|
mul = math.Clamp( (CurTime() - lastFire) / fireTime, 0, .5 )
|
||||||
|
mul = 1-mul;
|
||||||
|
end
|
||||||
|
|
||||||
|
targetPos.y = targetPos.y + (-self.Primary.IronShootForce * mul);
|
||||||
|
elseif mode == MODE_SPRINT then
|
||||||
|
speed = self.Owner:GetVelocity():Length();
|
||||||
|
local clamp = math.Clamp((4 + speed / 100) / (self.Owner:Crouching() and 1.5 or 1), 0, 7)
|
||||||
|
|
||||||
|
local co = math.cos(CurTime() * clamp);
|
||||||
|
local si = math.sin(CurTime() * clamp);
|
||||||
|
local ta = math.atan(co, si)
|
||||||
|
local ta2 = math.atan(co * si, co * si)
|
||||||
|
|
||||||
|
speedReduced = speed / 250
|
||||||
|
|
||||||
|
targetPos.x = targetPos.x + ta * 0.1375 * speedReduced;
|
||||||
|
targetPos.z = targetPos.z + ta2 * 0.0625 * speedReduced;
|
||||||
|
targetAng.y = targetAng.y + ta * 0.125 * speedReduced;
|
||||||
|
targetAng.x = targetAng.x + ta2 * 0.25 * speedReduced;
|
||||||
|
targetAng.z = targetAng.z + ta2 * 0.375 * speedReduced;
|
||||||
|
end
|
||||||
|
|
||||||
|
ang:RotateAroundAxis( ang:Right(), targetAng.x);
|
||||||
|
ang:RotateAroundAxis( ang:Up(), targetAng.y);
|
||||||
|
ang:RotateAroundAxis( ang:Forward(), targetAng.z);
|
||||||
|
pos = pos + targetPos.x * ang:Right();
|
||||||
|
pos = pos + targetPos.y * ang:Forward();
|
||||||
|
pos = pos + targetPos.z * ang:Up();
|
||||||
|
|
||||||
|
return pos, ang
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local lp,wep;
|
||||||
|
hook.Add("HUDPaint","drawHitMarkers",function()
|
||||||
|
lp=LocalPlayer();
|
||||||
|
if IsValid(lp) then
|
||||||
|
wep = lp:GetActiveWeapon();
|
||||||
|
if IsValid(wep) and wep.Markers then
|
||||||
|
for k,v in pairs( wep.Markers)do
|
||||||
|
if v.alpha < 5 then
|
||||||
|
table.remove( wep.Markers,k);
|
||||||
|
continue;
|
||||||
|
end
|
||||||
|
local pos = v.pos:ToScreen();
|
||||||
|
|
||||||
|
surface.SetDrawColor(Color(255,255,255,v.alpha))
|
||||||
|
surface.DrawLine(pos.x-2,pos.y-2,pos.x-5,pos.y-5);
|
||||||
|
surface.DrawLine(pos.x+2,pos.y+2,pos.x+5,pos.y+5);
|
||||||
|
surface.DrawLine(pos.x-2,pos.y+2,pos.x-5,pos.y+5);
|
||||||
|
surface.DrawLine(pos.x+2,pos.y-2,pos.x+5,pos.y-5);
|
||||||
|
v.alpha = v.alpha-FrameTime()*240;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
37
entities/weapons/weapon_jb_base/server.lua
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
resource.AddFile("materials/jailbreak_excl/crosshair.png");
|
||||||
|
|
||||||
|
SWEP.Weight = 5;
|
||||||
|
SWEP.AutoSwitchTo = false;
|
||||||
|
SWEP.AutoSwitchFrom = false;
|
||||||
496
entities/weapons/weapon_jb_base/shared.lua
Normal file
@@ -0,0 +1,496 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
These are the variables you may edit to add new guns:
|
||||||
|
|
||||||
|
*/
|
||||||
|
SWEP.Primary.NumShots = 1; // Number of bullets per shot fired, could be used to make a shotgun pellet effect.
|
||||||
|
SWEP.Primary.Automatic = true // Automatic firing mode
|
||||||
|
SWEP.Primary.Sound = Sound( "Weapon_AK47.Single" ); // Weapon sound. Always precache this using the Sound function!
|
||||||
|
SWEP.Primary.Ammo = "SMG1"; // ammo type, SMG1 for all primary weapons, pistol for secondary; we don't want complicated ammo systems in this gamemode!
|
||||||
|
SWEP.Primary.Recoil = 1.2; // recoil
|
||||||
|
SWEP.Primary.Damage = 40; // damage taken when a bullet is fired into a player's chest area (hitting head makes for more damage, limbs makes for less)
|
||||||
|
SWEP.Primary.Cone = 0.05; // spread
|
||||||
|
SWEP.Primary.MaxCone = 0.06; // maximum spread
|
||||||
|
SWEP.Primary.ShootConeAdd = 0.005; // how much should be added to the spread for every shot fired
|
||||||
|
SWEP.Primary.IronConeMul = 0.25; // accuracy multiplier when aiming down sights or zoomed
|
||||||
|
SWEP.Primary.CrouchConeMul = 0.8; // accuracy multiplier when crouched
|
||||||
|
SWEP.Primary.ClipSize = 27; // weapon clip size
|
||||||
|
SWEP.Primary.Delay = 0.13; // weapon delay
|
||||||
|
SWEP.Primary.IronShootForce = 2; // added force when aiming down the sights - for dramatic effect
|
||||||
|
SWEP.Primary.Burst = -1; // number of bursts, should be -1 if the weapon isn't a burst-fire weapon
|
||||||
|
SWEP.HoldType = "melee2" // should be smg1, ar2 or revolver
|
||||||
|
--SWEP.ReloadSequenceTime = 1.85; // for rechamber - Don't set this if you don't know it. Use the ModelViewer in SourceSDK to find out what the right time is.
|
||||||
|
SWEP.Primary.Range = WEAPON_SNIPER // sniper, smg, rifle or pistol effective range
|
||||||
|
SWEP.FakeIronSights = false // for weapons without proper ironsights, such as the M4A1
|
||||||
|
|
||||||
|
SWEP.Positions = {
|
||||||
|
{pos = Vector(0,0,0), ang = Vector(0,0,0)}, // Viewmodel positions in IDLE mode
|
||||||
|
{pos = Vector(0,0,0), ang = Vector(0,0,0)}, // Viewmodel positions in AIM mode
|
||||||
|
{pos = Vector(0,0,0), ang = Vector(0,0,0)} // Viewmodel positions in SPRINT mode
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
Anything below this line you shouldn't have to read or touch!
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
AddCSLuaFile("client.lua");
|
||||||
|
|
||||||
|
local cvarAimToggle;
|
||||||
|
|
||||||
|
if SERVER then
|
||||||
|
include("server.lua");
|
||||||
|
|
||||||
|
SWEP.AutoSwitchTo = true;
|
||||||
|
|
||||||
|
cvarAimToggle = {};
|
||||||
|
function cvarAimToggle:GetBool(ply)
|
||||||
|
return tobool(ply:GetInfoNum( "jb_cl_option_toggleaim", "0" ))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if CLIENT then
|
||||||
|
include("client.lua");
|
||||||
|
|
||||||
|
cvarAimToggle = CreateClientConVar( "jb_cl_option_toggleaim", "0", true, true )
|
||||||
|
end
|
||||||
|
|
||||||
|
SWEP.Primary.DefaultClip = SWEP.Primary.ClipSize; -- See: gamemode/core/sh_weapon_hack.lua
|
||||||
|
SWEP.IsDropped = false;
|
||||||
|
SWEP.Secondary.ClipSize = -1;
|
||||||
|
SWEP.Secondary.DefaultClip = -1;
|
||||||
|
SWEP.Secondary.Automatic = false;
|
||||||
|
SWEP.Secondary.Ammo = "none";
|
||||||
|
SWEP.Author = "Excl";
|
||||||
|
SWEP.Contact = "info@casualbananas.com";
|
||||||
|
SWEP.Purpose = "For use in the Jail Break 7 gamemode.";
|
||||||
|
SWEP.Instructions = "Left click to shoot, R to reload.";
|
||||||
|
SWEP.Spawnable = false
|
||||||
|
SWEP.AdminSpawnable = true
|
||||||
|
SWEP.Category = "Jail Break 7";
|
||||||
|
SWEP.UseHands = true;
|
||||||
|
|
||||||
|
local EffectiveRangeTable = {}
|
||||||
|
EffectiveRangeTable [WEAPON_SMG] = 1200;
|
||||||
|
EffectiveRangeTable [WEAPON_RIFLE] = 3000;
|
||||||
|
EffectiveRangeTable [WEAPON_SNIPER] = 10000;
|
||||||
|
EffectiveRangeTable [WEAPON_PISTOL] = 500;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local MODE_NORMAL = 1;
|
||||||
|
local MODE_AIM = 2;
|
||||||
|
local MODE_SPRINT = 3;
|
||||||
|
|
||||||
|
AccessorFunc(SWEP,"reloading","Reloading",FORCE_BOOL);
|
||||||
|
|
||||||
|
function SWEP:SetupDataTables()
|
||||||
|
self:NetworkVar( "Float", 0, "NWLastShoot" );
|
||||||
|
self:NetworkVar( "Int", 0, "NWMode" );
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:Initialize()
|
||||||
|
if IsValid(self) and self.SetWeaponHoldType then
|
||||||
|
self:SetWeaponHoldType(self.HoldType);
|
||||||
|
end
|
||||||
|
|
||||||
|
if CLIENT then
|
||||||
|
if not IsValid(self.ViewModelReference) then
|
||||||
|
self.ViewModelReference = ClientsideModel(self.ViewModel, RENDERGROUP_BOTH)
|
||||||
|
if not IsValid(self.ViewModelReference) then return end
|
||||||
|
self.ViewModelReference:SetNoDraw(true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:Deploy()
|
||||||
|
self:SendWeaponAnim(ACT_VM_DRAW);
|
||||||
|
self:SetNextPrimaryFire(CurTime() + 1);
|
||||||
|
|
||||||
|
self:SetNWMode(1);
|
||||||
|
self:SetReloading(false);
|
||||||
|
|
||||||
|
timer.Destroy(self.Owner:SteamID().."ReloadTimer")
|
||||||
|
|
||||||
|
self.originalWalkSpeed = IsValid(self.Owner) and self.Owner:GetWalkSpeed() or 260;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:Holster()
|
||||||
|
//self.OldAmmo = self:Clip1();
|
||||||
|
//self:SetClip1(1);
|
||||||
|
|
||||||
|
self:SetNWLastShoot(0);
|
||||||
|
|
||||||
|
if self.Owner.SteamID and self.Owner:SteamID() then
|
||||||
|
timer.Destroy(self.Owner:SteamID().."ReloadTimer")
|
||||||
|
end
|
||||||
|
|
||||||
|
if SERVER then
|
||||||
|
self.Owner:SetFOV(0,0.6)
|
||||||
|
self.Owner:SetWalkSpeed(self.originalWalkSpeed)
|
||||||
|
end
|
||||||
|
return true;
|
||||||
|
end
|
||||||
|
|
||||||
|
SWEP.NextReload = CurTime();
|
||||||
|
local timeStartReload;
|
||||||
|
function SWEP:Reload()
|
||||||
|
if self.NextReload > CurTime() or self.Owner:GetAmmoCount(self.Primary.Ammo) <= 0 or self:GetNWMode() == MODE_SPRINT or self:GetNWMode() == MODE_AIM or !IsFirstTimePredicted() then return end
|
||||||
|
|
||||||
|
self:SetNWMode(MODE_NORMAL);
|
||||||
|
self:SendWeaponAnim(ACT_VM_RELOAD);
|
||||||
|
self.Owner:SetAnimation(PLAYER_RELOAD);
|
||||||
|
|
||||||
|
self.NextReload = CurTime()+4;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local clip = self:Clip1();
|
||||||
|
local dur;
|
||||||
|
if clip > 0 then
|
||||||
|
self.Rechamber = false;
|
||||||
|
self:SetClip1(1);
|
||||||
|
|
||||||
|
dur = self.Owner:GetViewModel():SequenceDuration();
|
||||||
|
else
|
||||||
|
self.Rechamber = true;
|
||||||
|
|
||||||
|
dur = self.ReloadSequenceTime or self.Owner:GetViewModel():SequenceDuration();
|
||||||
|
end
|
||||||
|
|
||||||
|
self:SetNextPrimaryFire(CurTime()+dur);
|
||||||
|
timer.Create(self.Owner:SteamID().."ReloadTimer", dur,1,function()
|
||||||
|
if not self or not IsValid(self) or not self.Owner or not IsValid(self.Owner) then return end
|
||||||
|
|
||||||
|
amt = math.Clamp(self.Owner:GetAmmoCount(self.Primary.Ammo),0,self.Primary.ClipSize);
|
||||||
|
self.Owner:RemoveAmmo(amt,self.Primary.Ammo);
|
||||||
|
|
||||||
|
if not self.Rechamber then
|
||||||
|
if SERVER then
|
||||||
|
self:SetClip1(amt+1);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if SERVER then
|
||||||
|
self:SetClip1(amt);
|
||||||
|
end
|
||||||
|
self:SendWeaponAnim(ACT_VM_DRAW);
|
||||||
|
self:SetNextPrimaryFire(CurTime()+.2);
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
self:SetReloading(false);
|
||||||
|
end)
|
||||||
|
self:SetReloading(true);
|
||||||
|
|
||||||
|
self:SetNWLastShoot(0);
|
||||||
|
end
|
||||||
|
|
||||||
|
SWEP.AddCone = 0;
|
||||||
|
SWEP.LastShoot = CurTime();
|
||||||
|
SWEP.oldMul = 0.5;
|
||||||
|
|
||||||
|
SWEP.originalWalkSpeed = 260;
|
||||||
|
|
||||||
|
local speed;
|
||||||
|
function SWEP:Think()
|
||||||
|
if CLIENT and IsValid(self) then
|
||||||
|
speed= self.Owner:GetVelocity():Length();
|
||||||
|
|
||||||
|
if speed > self.Owner:GetWalkSpeed() + 20 and self.Owner:KeyDown(IN_SPEED) and self:GetNWMode() ~= MODE_SPRINT then
|
||||||
|
self:SetNWMode(MODE_SPRINT);
|
||||||
|
elseif speed <= 10 and self.Owner:KeyDown(IN_SPEED) and self:GetNWMode() == MODE_SPRINT then
|
||||||
|
self:SetNWMode(MODE_NORMAL);
|
||||||
|
end
|
||||||
|
|
||||||
|
if self:GetNWMode() == MODE_SPRINT and (!self.Owner:KeyDown(IN_SPEED) or speed < self.Owner:GetWalkSpeed()) then
|
||||||
|
self:SetNWMode(MODE_NORMAL);
|
||||||
|
end
|
||||||
|
elseif SERVER and IsValid(self) then
|
||||||
|
if IsFirstTimePredicted() then
|
||||||
|
speed= self.Owner:GetVelocity():Length();
|
||||||
|
local mul = 1;
|
||||||
|
if self.Owner:Crouching() and speed < 30 then
|
||||||
|
mul = self.Primary.CrouchConeMul;
|
||||||
|
elseif speed > self.Owner:GetWalkSpeed() + 20 then
|
||||||
|
mul = 2;
|
||||||
|
if self.Owner:KeyDown(IN_SPEED) then
|
||||||
|
self:SetNWMode(MODE_SPRINT);
|
||||||
|
end
|
||||||
|
elseif speed > 120 then
|
||||||
|
mul = 1.5;
|
||||||
|
end
|
||||||
|
|
||||||
|
if self:GetNWMode() == MODE_AIM then
|
||||||
|
mul = mul * self.Primary.IronConeMul;
|
||||||
|
end
|
||||||
|
|
||||||
|
if self:GetNWMode() == MODE_SPRINT and (!self.Owner:KeyDown(IN_SPEED) or speed < self.Owner:GetWalkSpeed()) then
|
||||||
|
self:SetNWMode(MODE_NORMAL);
|
||||||
|
end
|
||||||
|
|
||||||
|
self.oldMul = Lerp(0.5,self.oldMul,mul);
|
||||||
|
|
||||||
|
if self.LastShoot+0.2 < CurTime() then
|
||||||
|
self.AddCone = self.AddCone-(self.Primary.ShootConeAdd/5);
|
||||||
|
if self.AddCone < 0 then
|
||||||
|
self.AddCone=0;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self:SetNWLastShoot(math.Clamp((self.Primary.Cone+self.AddCone)*self.oldMul, 0.002, 0.12));
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if SERVER and self:GetNWMode() == MODE_AIM and self.Owner:GetWalkSpeed() ~= self.originalWalkSpeed*.65 then
|
||||||
|
self.Owner:SetWalkSpeed(self.originalWalkSpeed*.65)
|
||||||
|
elseif SERVER and self:GetNWMode() ~= MODE_AIM and self.Owner:GetWalkSpeed() ~= self.originalWalkSpeed then
|
||||||
|
self.Owner:SetWalkSpeed(self.originalWalkSpeed)
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.nextBurst and self.nextBurst <= CurTime() and self.burstLeft and self.burstLeft >= 1 then
|
||||||
|
self.burstLeft = self.burstLeft - 1;
|
||||||
|
self.nextBurst=CurTime()+self.Primary.Delay;
|
||||||
|
|
||||||
|
if self:Clip1() <= 0 then
|
||||||
|
self:EmitSound( "Weapon_Pistol.Empty" )
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
|
||||||
|
self:JB_ShootBullet( self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self:GetNWLastShoot(), self.Primary.NumShots)
|
||||||
|
|
||||||
|
self.AddCone = math.Clamp(self.AddCone+self.Primary.ShootConeAdd,0,self.Primary.MaxCone)
|
||||||
|
self.LastShoot = CurTime();
|
||||||
|
|
||||||
|
|
||||||
|
if SERVER then
|
||||||
|
self.Owner:EmitSound(self.Primary.Sound, 100, math.random(95, 105))
|
||||||
|
end
|
||||||
|
|
||||||
|
self:TakePrimaryAmmo(1);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:OnDrop()
|
||||||
|
if CLIENT or not IsValid(self.Owner) then return end
|
||||||
|
|
||||||
|
self.Owner:SetWalkSpeed(self.originalWalkSpeed)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function SWEP:PrimaryAttack()
|
||||||
|
if self:GetNWMode() == MODE_SPRINT then return end
|
||||||
|
|
||||||
|
local delay = self.Primary.Burst > 0 and self.Primary.Delay * (self.Primary.Burst + 1) or self.Primary.Delay;
|
||||||
|
|
||||||
|
if self:Clip1() <= 0 then
|
||||||
|
self:SetNextPrimaryFire(CurTime()+delay);
|
||||||
|
self:EmitSound( "Weapon_Pistol.Empty" )
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
|
||||||
|
self:SetNextPrimaryFire(CurTime()+delay);
|
||||||
|
|
||||||
|
self:JB_ShootBullet( self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self:GetNWLastShoot(), self.Primary.NumShots)
|
||||||
|
|
||||||
|
if IsFirstTimePredicted() and self.Primary.Burst > 0 then
|
||||||
|
self.nextBurst=CurTime()+self.Primary.Delay;
|
||||||
|
self.burstLeft=self.Primary.Burst-1;
|
||||||
|
end
|
||||||
|
|
||||||
|
self.AddCone = math.Clamp(self.AddCone+self.Primary.ShootConeAdd,0,self.Primary.MaxCone)
|
||||||
|
self.LastShoot = CurTime();
|
||||||
|
|
||||||
|
if SERVER then
|
||||||
|
self.Owner:EmitSound(self.Primary.Sound, 100, math.random(95, 105))
|
||||||
|
end
|
||||||
|
|
||||||
|
self:TakePrimaryAmmo(1);
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:SecondaryAttack()
|
||||||
|
if self:GetNWMode() == MODE_SPRINT or self:GetReloading() or (SERVER and not IsFirstTimePredicted()) then return end
|
||||||
|
|
||||||
|
self:SetNWMode(cvarAimToggle:GetBool(self.Owner) and (self:GetNWMode() == MODE_AIM and MODE_NORMAL or MODE_AIM) or MODE_AIM);
|
||||||
|
|
||||||
|
self:SetNextSecondaryFire(CurTime() + .3);
|
||||||
|
end
|
||||||
|
hook.Add("KeyRelease", "jbWepBaseHandleUnAim", function(p,k)
|
||||||
|
if IsValid(p) and k and k == IN_ATTACK2 and !cvarAimToggle:GetBool(p) then
|
||||||
|
local wep = p:GetActiveWeapon();
|
||||||
|
if IsValid(wep) and wep.GetNWMode and wep:GetNWMode() == MODE_AIM then
|
||||||
|
wep:SetNWMode(MODE_NORMAL);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
SWEP.Markers = {};
|
||||||
|
function SWEP:JB_ShootBullet( dmg, recoil, numbul, cone )
|
||||||
|
if IsFirstTimePredicted() then
|
||||||
|
local bullet = {
|
||||||
|
Num = numbul;
|
||||||
|
Src = self.Owner:GetShootPos();
|
||||||
|
Dir = ( self.Owner:EyeAngles() + self.Owner:GetPunchAngle() ):Forward();
|
||||||
|
Spread = Vector( cone, cone, 0 );
|
||||||
|
Tracer = 3;
|
||||||
|
Force = (dmg/4)*3;
|
||||||
|
Damage = dmg;
|
||||||
|
Callback = function(attacker, tr, dmginfo)
|
||||||
|
if tr.HitWorld and tr.MatType == MAT_METAL then
|
||||||
|
local eff = EffectData()
|
||||||
|
eff:SetOrigin(tr.HitPos)
|
||||||
|
eff:SetNormal(tr.HitNormal)
|
||||||
|
util.Effect("cball_bounce", eff)
|
||||||
|
end
|
||||||
|
|
||||||
|
if tr.Entity and IsValid(tr.Entity) and tr.Entity:IsPlayer() then
|
||||||
|
|
||||||
|
table.insert(self.Markers,{
|
||||||
|
pos = tr.HitPos, alpha = 255
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
self.Owner:FireBullets(bullet)
|
||||||
|
end
|
||||||
|
|
||||||
|
if self:GetNWMode() == MODE_NORMAL or (self:GetNWMode() == MODE_AIM and self.FakeIronSights) then
|
||||||
|
self:SendWeaponAnim(ACT_VM_PRIMARYATTACK);
|
||||||
|
end
|
||||||
|
self.Owner:SetAnimation(PLAYER_ATTACK1);
|
||||||
|
self.Owner:MuzzleFlash();
|
||||||
|
|
||||||
|
|
||||||
|
if CLIENT then
|
||||||
|
self:FireCallback();
|
||||||
|
|
||||||
|
if IsFirstTimePredicted() then
|
||||||
|
local eyeang = self.Owner:EyeAngles()
|
||||||
|
eyeang.pitch = eyeang.pitch - (recoil * 1 * 0.3)*2
|
||||||
|
eyeang.yaw = eyeang.yaw - (recoil * math.random(-1, 1) * 0.3)
|
||||||
|
self.Owner:SetEyeAngles( eyeang )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local ActivityTranslateHipFire = {}
|
||||||
|
ActivityTranslateHipFire [ ACT_MP_STAND_IDLE ] = ACT_HL2MP_IDLE_SHOTGUN;
|
||||||
|
ActivityTranslateHipFire [ ACT_MP_WALK ] = ACT_HL2MP_IDLE_SHOTGUN+1;
|
||||||
|
ActivityTranslateHipFire [ ACT_MP_RUN ] = ACT_HL2MP_IDLE_SHOTGUN+2;
|
||||||
|
ActivityTranslateHipFire [ ACT_MP_CROUCH_IDLE ] = ACT_HL2MP_IDLE_SHOTGUN+3;
|
||||||
|
ActivityTranslateHipFire [ ACT_MP_CROUCHWALK ] = ACT_HL2MP_IDLE_SHOTGUN+4;
|
||||||
|
ActivityTranslateHipFire [ ACT_MP_ATTACK_STAND_PRIMARYFIRE ] = ACT_HL2MP_IDLE_SMG1+5;
|
||||||
|
ActivityTranslateHipFire [ ACT_MP_ATTACK_CROUCH_PRIMARYFIRE ] = ACT_HL2MP_IDLE_SMG1+5;
|
||||||
|
ActivityTranslateHipFire [ ACT_MP_RELOAD_STAND ] = ACT_HL2MP_IDLE_SMG1+6;
|
||||||
|
ActivityTranslateHipFire [ ACT_MP_RELOAD_CROUCH ] = ACT_HL2MP_IDLE_SMG1+6;
|
||||||
|
ActivityTranslateHipFire [ ACT_MP_JUMP ] = ACT_HL2MP_IDLE_SHOTGUN+7;
|
||||||
|
ActivityTranslateHipFire [ ACT_RANGE_ATTACK1 ] = ACT_HL2MP_IDLE_SMG1+8;
|
||||||
|
ActivityTranslateHipFire [ ACT_MP_SWIM ] = ACT_HL2MP_IDLE_SHOTGUN+9;
|
||||||
|
|
||||||
|
local ActivityTranslatePistolNoAim = {}
|
||||||
|
ActivityTranslatePistolNoAim [ ACT_MP_STAND_IDLE ] = ACT_HL2MP_IDLE_PISTOL;
|
||||||
|
ActivityTranslatePistolNoAim [ ACT_MP_WALK ] = ACT_HL2MP_IDLE_PISTOL+1;
|
||||||
|
ActivityTranslatePistolNoAim [ ACT_MP_RUN ] = ACT_HL2MP_IDLE_PISTOL+2;
|
||||||
|
ActivityTranslatePistolNoAim [ ACT_MP_CROUCH_IDLE ] = ACT_HL2MP_IDLE_PISTOL+3;
|
||||||
|
ActivityTranslatePistolNoAim [ ACT_MP_CROUCHWALK ] = ACT_HL2MP_IDLE_PISTOL+4;
|
||||||
|
ActivityTranslatePistolNoAim [ ACT_MP_ATTACK_STAND_PRIMARYFIRE ] = ACT_HL2MP_IDLE_PISTOL+5;
|
||||||
|
ActivityTranslatePistolNoAim [ ACT_MP_ATTACK_CROUCH_PRIMARYFIRE ] = ACT_HL2MP_IDLE_PISTOL+5;
|
||||||
|
ActivityTranslatePistolNoAim [ ACT_MP_RELOAD_STAND ] = ACT_HL2MP_IDLE_PISTOL+6;
|
||||||
|
ActivityTranslatePistolNoAim [ ACT_MP_RELOAD_CROUCH ] = ACT_HL2MP_IDLE_PISTOL+6;
|
||||||
|
ActivityTranslatePistolNoAim [ ACT_MP_JUMP ] = ACT_HL2MP_IDLE_PISTOL+7;
|
||||||
|
ActivityTranslatePistolNoAim [ ACT_RANGE_ATTACK1 ] = ACT_HL2MP_IDLE_PISTOL+8;
|
||||||
|
ActivityTranslatePistolNoAim [ ACT_MP_SWIM ] = ACT_HL2MP_IDLE_PISTOL+9;
|
||||||
|
|
||||||
|
local ActivityTranslateSprintRifle = {}
|
||||||
|
ActivityTranslateSprintRifle [ ACT_MP_STAND_IDLE ] = ACT_HL2MP_IDLE_PASSIVE;
|
||||||
|
ActivityTranslateSprintRifle [ ACT_MP_WALK ] = ACT_HL2MP_IDLE_PASSIVE+1;
|
||||||
|
ActivityTranslateSprintRifle [ ACT_MP_RUN ] = ACT_HL2MP_IDLE_PASSIVE+2;
|
||||||
|
ActivityTranslateSprintRifle [ ACT_MP_CROUCH_IDLE ] = ACT_HL2MP_IDLE_PASSIVE+3;
|
||||||
|
ActivityTranslateSprintRifle [ ACT_MP_CROUCHWALK ] = ACT_HL2MP_IDLE_PASSIVE+4;
|
||||||
|
ActivityTranslateSprintRifle [ ACT_MP_ATTACK_STAND_PRIMARYFIRE ] = ACT_HL2MP_IDLE_PASSIVE+5;
|
||||||
|
ActivityTranslateSprintRifle [ ACT_MP_ATTACK_CROUCH_PRIMARYFIRE ] = ACT_HL2MP_IDLE_PASSIVE+5;
|
||||||
|
ActivityTranslateSprintRifle [ ACT_MP_RELOAD_STAND ] = ACT_HL2MP_IDLE_PASSIVE+6;
|
||||||
|
ActivityTranslateSprintRifle [ ACT_MP_RELOAD_CROUCH ] = ACT_HL2MP_IDLE_PASSIVE+6;
|
||||||
|
ActivityTranslateSprintRifle [ ACT_MP_JUMP ] = ACT_HL2MP_IDLE_PASSIVE+7;
|
||||||
|
ActivityTranslateSprintRifle [ ACT_RANGE_ATTACK1 ] = ACT_HL2MP_IDLE_PASSIVE+8;
|
||||||
|
ActivityTranslateSprintRifle [ ACT_MP_SWIM ] = ACT_HL2MP_IDLE_PASSIVE+9;
|
||||||
|
|
||||||
|
local ActivityTranslateSprintPistol = {}
|
||||||
|
ActivityTranslateSprintPistol [ ACT_MP_STAND_IDLE ] = ACT_HL2MP_IDLE;
|
||||||
|
ActivityTranslateSprintPistol [ ACT_MP_WALK ] = ACT_HL2MP_IDLE+1;
|
||||||
|
ActivityTranslateSprintPistol [ ACT_MP_RUN ] = ACT_HL2MP_IDLE+2;
|
||||||
|
ActivityTranslateSprintPistol [ ACT_MP_CROUCH_IDLE ] = ACT_HL2MP_IDLE+3;
|
||||||
|
ActivityTranslateSprintPistol [ ACT_MP_CROUCHWALK ] = ACT_HL2MP_IDLE+4;
|
||||||
|
ActivityTranslateSprintPistol [ ACT_MP_ATTACK_STAND_PRIMARYFIRE ] = ACT_HL2MP_IDLE+5;
|
||||||
|
ActivityTranslateSprintPistol [ ACT_MP_ATTACK_CROUCH_PRIMARYFIRE ] = ACT_HL2MP_IDLE+5;
|
||||||
|
ActivityTranslateSprintPistol [ ACT_MP_RELOAD_STAND ] = ACT_HL2MP_IDLE+6;
|
||||||
|
ActivityTranslateSprintPistol [ ACT_MP_RELOAD_CROUCH ] = ACT_HL2MP_IDLE+6;
|
||||||
|
ActivityTranslateSprintPistol [ ACT_MP_JUMP ] = ACT_HL2MP_IDLE_DUEL+7;
|
||||||
|
ActivityTranslateSprintPistol [ ACT_RANGE_ATTACK1 ] = ACT_HL2MP_IDLE+8;
|
||||||
|
ActivityTranslateSprintPistol [ ACT_MP_SWIM ] = ACT_HL2MP_IDLE+9;
|
||||||
|
|
||||||
|
function SWEP:TranslateActivity( act )
|
||||||
|
|
||||||
|
local holdtype = string.lower(self.HoldType);
|
||||||
|
|
||||||
|
if ( holdtype == "ar2" or holdtype=="smg" ) then
|
||||||
|
if self:GetNWMode() == MODE_NORMAL and ActivityTranslateHipFire[ act ] ~= nil then
|
||||||
|
return ActivityTranslateHipFire[ act ]
|
||||||
|
elseif self:GetNWMode() == MODE_SPRINT and ActivityTranslateSprintRifle[ act ] ~= nil then
|
||||||
|
return ActivityTranslateSprintRifle[act];
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( holdtype == "revolver" or holdtype=="pistol") then
|
||||||
|
if self:GetNWMode() == MODE_NORMAL and holdtype == "revolver" and ActivityTranslatePistolNoAim[ act ] ~= nil then
|
||||||
|
return ActivityTranslatePistolNoAim[ act ]
|
||||||
|
elseif self:GetNWMode() == MODE_SPRINT and ActivityTranslateSprintPistol[ act ] ~= nil then
|
||||||
|
return ActivityTranslateSprintPistol[ act ]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( self.ActivityTranslate[ act ] ~= nil ) then
|
||||||
|
return self.ActivityTranslate[ act ]
|
||||||
|
end
|
||||||
|
|
||||||
|
return -1
|
||||||
|
|
||||||
|
end
|
||||||
68
entities/weapons/weapon_jb_deagle.lua
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
SWEP.PrintName = "Desert Eagle"
|
||||||
|
|
||||||
|
SWEP.Slot = 2
|
||||||
|
SWEP.SlotPos = 1
|
||||||
|
|
||||||
|
SWEP.HoldType = "revolver"
|
||||||
|
SWEP.Base = "weapon_jb_base"
|
||||||
|
SWEP.Category = "Jailbreak Weapons"
|
||||||
|
|
||||||
|
SWEP.Spawnable = true
|
||||||
|
SWEP.AdminSpawnable = true
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_pist_deagle.mdl"
|
||||||
|
SWEP.WorldModel = "models/weapons/w_pist_deagle.mdl"
|
||||||
|
|
||||||
|
SWEP.Weight = 1
|
||||||
|
SWEP.AutoSwitchTo = true
|
||||||
|
SWEP.AutoSwitchFrom = false
|
||||||
|
|
||||||
|
SWEP.Primary.Sound = Sound("Weapon_Deagle.Single")
|
||||||
|
SWEP.Primary.Recoil = 2.5
|
||||||
|
SWEP.Primary.Damage = 60
|
||||||
|
SWEP.Primary.NumShots = 1
|
||||||
|
SWEP.Primary.Cone = 0.02
|
||||||
|
SWEP.Primary.ClipSize = 8
|
||||||
|
SWEP.Primary.Delay = 0.3
|
||||||
|
SWEP.Primary.DefaultClip = 24
|
||||||
|
SWEP.Primary.Automatic = false
|
||||||
|
SWEP.Primary.Ammo = "pistol"
|
||||||
|
|
||||||
|
SWEP.Positions = {};
|
||||||
|
SWEP.Positions[1] = {pos = Vector(0,0,0), ang = Vector(0,0,0)};
|
||||||
|
SWEP.Positions[2] = {pos = Vector(-6.378, -7.954, 2.039), ang = Vector(0.4, 0, 0)};
|
||||||
|
SWEP.Positions[3] = {pos = Vector(2.44, -14.882, -20), ang = Vector(70, 0.827, 0)};
|
||||||
70
entities/weapons/weapon_jb_famas.lua
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
SWEP.PrintName = "Famas"
|
||||||
|
|
||||||
|
SWEP.Slot = 1
|
||||||
|
SWEP.SlotPos = 1
|
||||||
|
;
|
||||||
|
SWEP.HoldType = "ar2"
|
||||||
|
SWEP.Base = "weapon_jb_base"
|
||||||
|
SWEP.Category = "Jailbreak Weapons"
|
||||||
|
|
||||||
|
SWEP.Spawnable = true
|
||||||
|
SWEP.AdminSpawnable = true
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_rif_famas.mdl"
|
||||||
|
SWEP.WorldModel = "models/weapons/w_rif_famas.mdl"
|
||||||
|
|
||||||
|
SWEP.Primary.Automatic = false;
|
||||||
|
SWEP.Primary.Sound = Sound( "weapon_famas.Single" )
|
||||||
|
SWEP.Primary.Recoil = 1
|
||||||
|
SWEP.Primary.Damage = 34
|
||||||
|
SWEP.Primary.NumShots = 1
|
||||||
|
SWEP.Primary.Cone = 0.01
|
||||||
|
SWEP.Primary.ClipSize = 30
|
||||||
|
SWEP.Primary.Delay = 0.09
|
||||||
|
SWEP.Primary.DefaultClip = 90
|
||||||
|
SWEP.Primary.ShootConeAdd = 0.002;
|
||||||
|
SWEP.Primary.Automatic = false
|
||||||
|
SWEP.Primary.Ammo = "smg1"
|
||||||
|
|
||||||
|
SWEP.FakeIronSights = true;
|
||||||
|
|
||||||
|
SWEP.Primary.Burst = 3;
|
||||||
|
|
||||||
|
SWEP.Positions = {};
|
||||||
|
SWEP.Positions[1] = {pos = Vector(0,0,0), ang = Vector(0,0,0)};
|
||||||
|
SWEP.Positions[2] = {pos = Vector(-6.2, -3.386, 1.36), ang = Vector(0,0,0)};
|
||||||
|
SWEP.Positions[3] = {pos = Vector(6.534, -14.094, 0.708), ang = Vector(0,70,0)};
|
||||||
335
entities/weapons/weapon_jb_fists.lua
Normal file
@@ -0,0 +1,335 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
-- NOTE: Loosely based on the default Garry's Mod hands.
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
SWEP.PrintName = "Fists";
|
||||||
|
|
||||||
|
SWEP.UseHands = true;
|
||||||
|
|
||||||
|
SWEP.Author = "Excl"
|
||||||
|
SWEP.Purpose = ""
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/c_arms_citizen.mdl"
|
||||||
|
SWEP.WorldModel = ""
|
||||||
|
|
||||||
|
SWEP.ViewModelFOV = 52
|
||||||
|
SWEP.Slot = 0
|
||||||
|
SWEP.SlotPos = 5
|
||||||
|
|
||||||
|
SWEP.Primary.ClipSize = -1
|
||||||
|
SWEP.Primary.DefaultClip = -1
|
||||||
|
SWEP.Primary.Automatic = true
|
||||||
|
SWEP.Primary.Ammo = "none"
|
||||||
|
|
||||||
|
SWEP.Secondary.ClipSize = -1
|
||||||
|
SWEP.Secondary.DefaultClip = -1
|
||||||
|
SWEP.Secondary.Automatic = true
|
||||||
|
SWEP.Secondary.Ammo = "none"
|
||||||
|
|
||||||
|
local SwingSound = Sound( "weapons/slam/throw.wav" )
|
||||||
|
local HitSound = Sound( "Flesh.ImpactHard" )
|
||||||
|
|
||||||
|
function SWEP:PreDrawViewModel( vm, wep, ply )
|
||||||
|
if not self:GetRaised() then
|
||||||
|
self.Correct = true;
|
||||||
|
render.SetBlend(0);
|
||||||
|
else
|
||||||
|
self.Corrent = false;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:PostDrawViewModel( vm, wep, ply )
|
||||||
|
if self.Corrent then
|
||||||
|
render.SetBlend(1);
|
||||||
|
self.Correct = false;
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
SWEP.HitDistance = 48
|
||||||
|
|
||||||
|
function SWEP:SetupDataTables()
|
||||||
|
|
||||||
|
self:NetworkVar( "Float", 0, "NextMeleeAttack" )
|
||||||
|
self:NetworkVar( "Float", 1, "NextIdle" )
|
||||||
|
self:NetworkVar( "Int", 0, "Combo" )
|
||||||
|
self:NetworkVar( "Bool", 0, "Raised" );
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:UpdateNextIdle()
|
||||||
|
|
||||||
|
local vm = self.Owner:GetViewModel()
|
||||||
|
self:SetNextIdle( CurTime() + vm:SequenceDuration() )
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:PrimaryAttack( right )
|
||||||
|
if not self:GetRaised() then
|
||||||
|
if CLIENT and IsFirstTimePredicted() and !self.Owner.DoNotNotify then
|
||||||
|
notification.AddLegacy("Press R to raise your fists",NOTIFY_HINT);
|
||||||
|
self:SetNextPrimaryFire( CurTime() + 1.8 )
|
||||||
|
self:SetNextSecondaryFire( CurTime() + 1.8 )
|
||||||
|
self.Owner.DoNotNotify = true;
|
||||||
|
end
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
|
||||||
|
self.Owner:SetAnimation( PLAYER_ATTACK1 )
|
||||||
|
|
||||||
|
local anim = "fists_left"
|
||||||
|
if ( right ) then anim = "fists_right" end
|
||||||
|
if ( self:GetCombo() >= 2 ) then
|
||||||
|
anim = "fists_uppercut"
|
||||||
|
end
|
||||||
|
|
||||||
|
local vm = self.Owner:GetViewModel()
|
||||||
|
vm:SendViewModelMatchingSequence( vm:LookupSequence( anim ) )
|
||||||
|
|
||||||
|
self:EmitSound( SwingSound )
|
||||||
|
|
||||||
|
self:UpdateNextIdle()
|
||||||
|
self:SetNextMeleeAttack( CurTime() + 0.2 )
|
||||||
|
|
||||||
|
self:SetNextPrimaryFire( CurTime() + 0.6 )
|
||||||
|
self:SetNextSecondaryFire( CurTime() + 0.6 )
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:Reload()
|
||||||
|
if self.NextReload and self.NextReload > CurTime() then return end
|
||||||
|
|
||||||
|
self:SetRaised(not self:GetRaised());
|
||||||
|
if CLIENT then
|
||||||
|
if self:GetRaised() and IsFirstTimePredicted() then
|
||||||
|
local vm = self.Owner:GetViewModel()
|
||||||
|
vm:SendViewModelMatchingSequence( vm:LookupSequence( "fists_draw" ) )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.NextReload = CurTime() + 1;
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:SecondaryAttack()
|
||||||
|
self:PrimaryAttack( true )
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:DealDamage()
|
||||||
|
|
||||||
|
local anim = self:GetSequenceName(self.Owner:GetViewModel():GetSequence())
|
||||||
|
|
||||||
|
self.Owner:LagCompensation( true )
|
||||||
|
|
||||||
|
local tr = util.TraceLine( {
|
||||||
|
start = self.Owner:GetShootPos(),
|
||||||
|
endpos = self.Owner:GetShootPos() + self.Owner:GetAimVector() * self.HitDistance,
|
||||||
|
filter = self.Owner
|
||||||
|
} )
|
||||||
|
|
||||||
|
if ( !IsValid( tr.Entity ) ) then
|
||||||
|
tr = util.TraceHull( {
|
||||||
|
start = self.Owner:GetShootPos(),
|
||||||
|
endpos = self.Owner:GetShootPos() + self.Owner:GetAimVector() * self.HitDistance,
|
||||||
|
filter = self.Owner,
|
||||||
|
mins = Vector( -10, -10, -8 ),
|
||||||
|
maxs = Vector( 10, 10, 8 )
|
||||||
|
} )
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( tr.Hit ) then self:EmitSound( HitSound ) end
|
||||||
|
|
||||||
|
local hit = false
|
||||||
|
|
||||||
|
if ( SERVER && IsValid( tr.Entity ) && ( tr.Entity:IsNPC() || tr.Entity:IsPlayer() || tr.Entity:Health() > 0 ) ) then
|
||||||
|
local dmginfo = DamageInfo()
|
||||||
|
|
||||||
|
local attacker = self.Owner
|
||||||
|
if ( !IsValid( attacker ) ) then attacker = self end
|
||||||
|
dmginfo:SetAttacker( attacker )
|
||||||
|
|
||||||
|
dmginfo:SetInflictor( self )
|
||||||
|
dmginfo:SetDamage( math.random( 8,12 ) )
|
||||||
|
|
||||||
|
if ( anim == "fists_left" ) then
|
||||||
|
dmginfo:SetDamageForce( self.Owner:GetRight() * 49125 + self.Owner:GetForward() * 99984 ) -- Yes we need those specific numbers
|
||||||
|
elseif ( anim == "fists_right" ) then
|
||||||
|
dmginfo:SetDamageForce( self.Owner:GetRight() * -49124 + self.Owner:GetForward() * 99899 )
|
||||||
|
elseif ( anim == "fists_uppercut" ) then
|
||||||
|
dmginfo:SetDamageForce( self.Owner:GetUp() * 51589 + self.Owner:GetForward() * 100128 )
|
||||||
|
dmginfo:SetDamage( math.random( 10, 40 ) )
|
||||||
|
end
|
||||||
|
|
||||||
|
tr.Entity:TakeDamageInfo( dmginfo )
|
||||||
|
hit = true
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( SERVER && IsValid( tr.Entity ) ) then
|
||||||
|
local phys = tr.Entity:GetPhysicsObject()
|
||||||
|
if ( IsValid( phys ) ) then
|
||||||
|
phys:ApplyForceOffset( self.Owner:GetAimVector() * 80 * phys:GetMass(), tr.HitPos )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( SERVER ) then
|
||||||
|
if ( hit && anim ~= "fists_uppercut" ) then
|
||||||
|
self:SetCombo( self:GetCombo() + 1 )
|
||||||
|
else
|
||||||
|
self:SetCombo( 0 )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self.Owner:LagCompensation( false )
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:OnRemove()
|
||||||
|
|
||||||
|
if ( IsValid( self.Owner ) ) then
|
||||||
|
local vm = self.Owner:GetViewModel()
|
||||||
|
if ( IsValid( vm ) ) then vm:SetMaterial( "" ) end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:Holster( wep )
|
||||||
|
|
||||||
|
self:OnRemove()
|
||||||
|
|
||||||
|
return true
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:Deploy()
|
||||||
|
|
||||||
|
local vm = self.Owner:GetViewModel()
|
||||||
|
vm:SendViewModelMatchingSequence( vm:LookupSequence( "fists_draw" ) )
|
||||||
|
|
||||||
|
self:UpdateNextIdle()
|
||||||
|
|
||||||
|
if ( SERVER ) then
|
||||||
|
self:SetCombo( 0 )
|
||||||
|
end
|
||||||
|
|
||||||
|
self:SetRaised(false);
|
||||||
|
|
||||||
|
return true
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:Think()
|
||||||
|
if self:GetRaised() then
|
||||||
|
|
||||||
|
local vm = self.Owner:GetViewModel()
|
||||||
|
local curtime = CurTime()
|
||||||
|
local idletime = self:GetNextIdle()
|
||||||
|
|
||||||
|
if ( idletime > 0 && CurTime() > idletime ) then
|
||||||
|
|
||||||
|
vm:SendViewModelMatchingSequence( vm:LookupSequence( "fists_idle_0" .. math.random( 1, 2 ) ) )
|
||||||
|
|
||||||
|
self:UpdateNextIdle()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
local meleetime = self:GetNextMeleeAttack()
|
||||||
|
|
||||||
|
if ( meleetime > 0 && CurTime() > meleetime ) then
|
||||||
|
|
||||||
|
self:DealDamage()
|
||||||
|
|
||||||
|
self:SetNextMeleeAttack( 0 )
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( SERVER && CurTime() > self:GetNextPrimaryFire() + 0.1 ) then
|
||||||
|
|
||||||
|
self:SetCombo( 0 )
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local index;
|
||||||
|
|
||||||
|
index = ACT_HL2MP_IDLE;
|
||||||
|
|
||||||
|
SWEP.ActivityTranslateNotRaised = {}
|
||||||
|
SWEP.ActivityTranslateNotRaised [ ACT_MP_STAND_IDLE ] = index
|
||||||
|
SWEP.ActivityTranslateNotRaised [ ACT_MP_WALK ] = index+1
|
||||||
|
SWEP.ActivityTranslateNotRaised [ ACT_MP_RUN ] = index+2
|
||||||
|
SWEP.ActivityTranslateNotRaised [ ACT_MP_CROUCH_IDLE ] = index+3
|
||||||
|
SWEP.ActivityTranslateNotRaised [ ACT_MP_CROUCHWALK ] = index+4
|
||||||
|
SWEP.ActivityTranslateNotRaised [ ACT_MP_ATTACK_STAND_PRIMARYFIRE ] = index+5
|
||||||
|
SWEP.ActivityTranslateNotRaised [ ACT_MP_ATTACK_CROUCH_PRIMARYFIRE ] = index+5
|
||||||
|
SWEP.ActivityTranslateNotRaised [ ACT_MP_RELOAD_STAND ] = index+6
|
||||||
|
SWEP.ActivityTranslateNotRaised [ ACT_MP_RELOAD_CROUCH ] = index+6
|
||||||
|
SWEP.ActivityTranslateNotRaised [ ACT_MP_JUMP ] = ACT_HL2MP_IDLE_DUEL+7
|
||||||
|
SWEP.ActivityTranslateNotRaised [ ACT_RANGE_ATTACK1 ] = index+8
|
||||||
|
SWEP.ActivityTranslateNotRaised [ ACT_MP_SWIM ] = index+9
|
||||||
|
|
||||||
|
index=ACT_HL2MP_IDLE_FIST;
|
||||||
|
|
||||||
|
SWEP.ActivityTranslateRaised = {}
|
||||||
|
SWEP.ActivityTranslateRaised [ ACT_MP_STAND_IDLE ] = index
|
||||||
|
SWEP.ActivityTranslateRaised [ ACT_MP_WALK ] = index+1
|
||||||
|
SWEP.ActivityTranslateRaised [ ACT_MP_RUN ] = index+2
|
||||||
|
SWEP.ActivityTranslateRaised [ ACT_MP_CROUCH_IDLE ] = index+3
|
||||||
|
SWEP.ActivityTranslateRaised [ ACT_MP_CROUCHWALK ] = index+4
|
||||||
|
SWEP.ActivityTranslateRaised [ ACT_MP_ATTACK_STAND_PRIMARYFIRE ] = index+5
|
||||||
|
SWEP.ActivityTranslateRaised [ ACT_MP_ATTACK_CROUCH_PRIMARYFIRE ] = index+5
|
||||||
|
SWEP.ActivityTranslateRaised [ ACT_MP_RELOAD_STAND ] = index+6
|
||||||
|
SWEP.ActivityTranslateRaised [ ACT_MP_RELOAD_CROUCH ] = index+6
|
||||||
|
SWEP.ActivityTranslateRaised [ ACT_MP_JUMP ] = index+7
|
||||||
|
SWEP.ActivityTranslateRaised [ ACT_RANGE_ATTACK1 ] = index+8
|
||||||
|
SWEP.ActivityTranslateRaised [ ACT_MP_SWIM ] = index+9
|
||||||
|
|
||||||
|
index=nil;
|
||||||
|
|
||||||
|
function SWEP:TranslateActivity( act )
|
||||||
|
|
||||||
|
if self:GetRaised() then
|
||||||
|
if ( self.ActivityTranslateRaised[ act ] ~= nil ) then
|
||||||
|
return self.ActivityTranslateRaised[ act ]
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if ( self.ActivityTranslateNotRaised[ act ] ~= nil ) then
|
||||||
|
return self.ActivityTranslateNotRaised[ act ]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return -1
|
||||||
|
|
||||||
|
end
|
||||||
69
entities/weapons/weapon_jb_fiveseven.lua
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
|
||||||
|
SWEP.PrintName = "Five-Seven"
|
||||||
|
|
||||||
|
SWEP.Slot = 2
|
||||||
|
SWEP.SlotPos = 1
|
||||||
|
;
|
||||||
|
SWEP.HoldType = "revolver"
|
||||||
|
SWEP.Base = "weapon_jb_base"
|
||||||
|
SWEP.Category = "Jailbreak Weapons"
|
||||||
|
|
||||||
|
SWEP.Spawnable = true
|
||||||
|
SWEP.AdminSpawnable = true
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_pist_fiveseven.mdl"
|
||||||
|
SWEP.WorldModel = "models/weapons/w_pist_fiveseven.mdl"
|
||||||
|
|
||||||
|
SWEP.Weight = 1
|
||||||
|
SWEP.AutoSwitchTo = true
|
||||||
|
SWEP.AutoSwitchFrom = false
|
||||||
|
|
||||||
|
SWEP.Primary.Sound = Sound("Weapon_FiveSeven.Single")
|
||||||
|
SWEP.Primary.Recoil = 1.2
|
||||||
|
SWEP.Primary.Damage = 18
|
||||||
|
SWEP.Primary.NumShots = 1
|
||||||
|
SWEP.Primary.Cone = 0.02
|
||||||
|
SWEP.Primary.ClipSize = 21
|
||||||
|
SWEP.Primary.Delay = 0.05
|
||||||
|
SWEP.Primary.DefaultClip = 21
|
||||||
|
SWEP.Primary.Automatic = false
|
||||||
|
SWEP.Primary.Ammo = "pistol"
|
||||||
|
|
||||||
|
SWEP.Positions = {};
|
||||||
|
SWEP.Positions[1] = {pos = Vector(0,0,0), ang = Vector(0,0,0)};
|
||||||
|
SWEP.Positions[2] = {pos = Vector(-5.921, -1.339, 3.039), ang = Vector(-0.401, 0.1, 0)};
|
||||||
|
SWEP.Positions[3] = {pos = Vector(0, -15.669, -15.827), ang = Vector(70, 0.275, -0.276)};
|
||||||
68
entities/weapons/weapon_jb_galil.lua
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
SWEP.PrintName = "Galil"
|
||||||
|
|
||||||
|
SWEP.Slot = 1
|
||||||
|
SWEP.SlotPos = 1
|
||||||
|
|
||||||
|
SWEP.HoldType = "ar2"
|
||||||
|
SWEP.Base = "weapon_jb_base"
|
||||||
|
SWEP.Category = "Jailbreak Weapons"
|
||||||
|
|
||||||
|
SWEP.Spawnable = true
|
||||||
|
SWEP.AdminSpawnable = true
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_rif_galil.mdl"
|
||||||
|
SWEP.WorldModel = "models/weapons/w_rif_galil.mdl"
|
||||||
|
|
||||||
|
SWEP.Weight = 5
|
||||||
|
SWEP.AutoSwitchTo = true
|
||||||
|
SWEP.AutoSwitchFrom = false
|
||||||
|
|
||||||
|
SWEP.Primary.Sound = Sound( "Weapon_Galil.Single" )
|
||||||
|
SWEP.Primary.Recoil = 0.5
|
||||||
|
SWEP.Primary.Damage = 25
|
||||||
|
SWEP.Primary.NumShots = 1
|
||||||
|
SWEP.Primary.Cone = 0.03
|
||||||
|
SWEP.Primary.ClipSize = 35
|
||||||
|
SWEP.Primary.Delay = 0.1
|
||||||
|
SWEP.Primary.DefaultClip = 90
|
||||||
|
SWEP.Primary.Automatic = true
|
||||||
|
SWEP.Primary.Ammo = "smg1"
|
||||||
|
|
||||||
|
SWEP.Positions = {};
|
||||||
|
SWEP.Positions[1] = {pos = Vector(0,0,0), ang = Vector(0,0,0)};
|
||||||
|
SWEP.Positions[2] = {pos = Vector(-6.361, -12.801, 2.519), ang = Vector(0,0,0)};
|
||||||
|
SWEP.Positions[3] = {pos = Vector(6.534, -6, 0.708), ang = Vector(0,70,0)};
|
||||||
71
entities/weapons/weapon_jb_glock.lua
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
SWEP.PrintName = "Glock 18"
|
||||||
|
|
||||||
|
|
||||||
|
SWEP.Slot = 2
|
||||||
|
SWEP.SlotPos = 1
|
||||||
|
|
||||||
|
SWEP.HoldType = "revolver"
|
||||||
|
SWEP.Base = "weapon_jb_base"
|
||||||
|
SWEP.Category = "Jailbreak Weapons"
|
||||||
|
|
||||||
|
SWEP.Spawnable = true
|
||||||
|
SWEP.AdminSpawnable = true
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_pist_glock18.mdl"
|
||||||
|
SWEP.WorldModel = "models/weapons/w_pist_glock18.mdl"
|
||||||
|
|
||||||
|
SWEP.Weight = 1
|
||||||
|
SWEP.AutoSwitchTo = true
|
||||||
|
SWEP.AutoSwitchFrom = false
|
||||||
|
|
||||||
|
SWEP.Primary.Sound = Sound("Weapon_Glock.Single")
|
||||||
|
SWEP.Primary.Recoil = 1.5
|
||||||
|
SWEP.Primary.Damage = 18
|
||||||
|
SWEP.Primary.NumShots = 1
|
||||||
|
SWEP.Primary.Cone = 0.01
|
||||||
|
SWEP.Primary.ClipSize = 30
|
||||||
|
SWEP.Primary.Delay = 0.065
|
||||||
|
SWEP.Primary.DefaultClip = SWEP.Primary.ClipSize
|
||||||
|
SWEP.Primary.Automatic = false
|
||||||
|
SWEP.Primary.Burst = 4
|
||||||
|
SWEP.Primary.Ammo = "pistol"
|
||||||
|
|
||||||
|
|
||||||
|
SWEP.Positions = {};
|
||||||
|
SWEP.Positions[1] = {pos = Vector(0,0,0), ang = Vector(0,0,0)};
|
||||||
|
SWEP.Positions[2] = {pos = Vector(-5.761, -2.126, 2.68), ang = Vector(0.699, 0.1, 0)};
|
||||||
|
SWEP.Positions[3] = {pos = Vector(0, -15.669, -15.827), ang = Vector(70, 0.275, -0.276)};
|
||||||
178
entities/weapons/weapon_jb_knife.lua
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
if SERVER then
|
||||||
|
|
||||||
|
SWEP.Weight = 5;
|
||||||
|
SWEP.AutoSwitchTo = false;
|
||||||
|
SWEP.AutoSwitchFrom = false;
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if CLIENT then
|
||||||
|
SWEP.DrawCrosshair = false;
|
||||||
|
SWEP.ViewModelFlip = false;
|
||||||
|
SWEP.DrawWeaponInfoBox = false;
|
||||||
|
|
||||||
|
SWEP.ViewModelFOV = 54
|
||||||
|
end
|
||||||
|
|
||||||
|
SWEP.Slot = 3
|
||||||
|
SWEP.SlotPos = 1
|
||||||
|
;
|
||||||
|
SWEP.Author = "Excl";
|
||||||
|
SWEP.Contact = "";
|
||||||
|
SWEP.Purpose = "";
|
||||||
|
SWEP.Instructions = "";
|
||||||
|
SWEP.Spawnable = false
|
||||||
|
SWEP.AdminSpawnable = false
|
||||||
|
SWEP.PrintName = "Knife"
|
||||||
|
|
||||||
|
SWEP.UseHands = true;
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_knife_t.mdl"
|
||||||
|
SWEP.WorldModel = "models/weapons/w_knife_t.mdl"
|
||||||
|
SWEP.Weight = 5
|
||||||
|
SWEP.DrawCrosshair = false
|
||||||
|
SWEP.ViewModelFlip = false
|
||||||
|
SWEP.Primary.Damage = 25
|
||||||
|
SWEP.Primary.ClipSize = -1
|
||||||
|
SWEP.Primary.DefaultClip = -1
|
||||||
|
SWEP.Primary.Automatic = true
|
||||||
|
SWEP.Primary.Delay = 0.5
|
||||||
|
SWEP.Primary.Ammo = "none"
|
||||||
|
SWEP.Secondary.ClipSize = -1
|
||||||
|
SWEP.Secondary.DefaultClip = -1
|
||||||
|
SWEP.Secondary.Automatic = true
|
||||||
|
SWEP.Secondary.Ammo = "none"
|
||||||
|
SWEP.Secondary.Delay = 5
|
||||||
|
SWEP.HoldType = "knife"
|
||||||
|
SWEP.HitDistance = 50;
|
||||||
|
|
||||||
|
local sound_single =Sound("weapons/knife/knife_slash1.wav")
|
||||||
|
function SWEP:Initialize()
|
||||||
|
self:SetWeaponHoldType(self.HoldType)
|
||||||
|
end
|
||||||
|
function SWEP:PrimaryAttack()
|
||||||
|
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
|
||||||
|
|
||||||
|
if not IsValid(self.Owner) then return end
|
||||||
|
|
||||||
|
if self.Owner.LagCompensation and SERVER then
|
||||||
|
self.Owner:LagCompensation(true);
|
||||||
|
end
|
||||||
|
|
||||||
|
self.Owner:SetAnimation( PLAYER_ATTACK1 )
|
||||||
|
|
||||||
|
local spos = self.Owner:GetShootPos()
|
||||||
|
local sdest = spos + (self.Owner:GetAimVector() * 70)
|
||||||
|
|
||||||
|
local tr_main = util.TraceLine( {
|
||||||
|
start = self.Owner:GetShootPos(),
|
||||||
|
endpos = self.Owner:GetShootPos() + self.Owner:GetAimVector() * self.HitDistance,
|
||||||
|
filter = self.Owner
|
||||||
|
} )
|
||||||
|
|
||||||
|
if ( !IsValid( tr_main.Entity ) ) then
|
||||||
|
tr_main = util.TraceHull( {
|
||||||
|
start = self.Owner:GetShootPos(),
|
||||||
|
endpos = self.Owner:GetShootPos() + self.Owner:GetAimVector() * self.HitDistance,
|
||||||
|
filter = self.Owner,
|
||||||
|
mins = Vector( -15, -15, -8 ),
|
||||||
|
maxs = Vector( 15, 15, 8 )
|
||||||
|
} )
|
||||||
|
end
|
||||||
|
local hitEnt = tr_main.Entity
|
||||||
|
|
||||||
|
self.Weapon:EmitSound(sound_single)
|
||||||
|
|
||||||
|
if IsValid(hitEnt) or tr_main.HitWorld then
|
||||||
|
self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )
|
||||||
|
|
||||||
|
if SERVER and IsFirstTimePredicted() then
|
||||||
|
local edata = EffectData()
|
||||||
|
edata:SetStart(spos)
|
||||||
|
edata:SetOrigin(tr_main.HitPos)
|
||||||
|
edata:SetNormal(tr_main.Normal)
|
||||||
|
edata:SetEntity(hitEnt)
|
||||||
|
|
||||||
|
if hitEnt:IsPlayer() or hitEnt:GetClass() == "prop_ragdoll" then
|
||||||
|
util.Effect("BloodImpact", edata)
|
||||||
|
self.Owner:FireBullets({Num=1, Src=spos, Dir=self.Owner:GetAimVector(), Spread=Vector(0,0,0), Tracer=0, Force=1, Damage=0});
|
||||||
|
else
|
||||||
|
util.Effect("Impact", edata)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER )
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if CLIENT then
|
||||||
|
-- used to be some shit here
|
||||||
|
else
|
||||||
|
if hitEnt and hitEnt:IsValid() then
|
||||||
|
local dmg = DamageInfo()
|
||||||
|
dmg:SetDamage(self.Primary.Damage)
|
||||||
|
dmg:SetAttacker(self.Owner)
|
||||||
|
dmg:SetInflictor(self.Weapon)
|
||||||
|
dmg:SetDamageForce(self.Owner:GetAimVector() * 1500)
|
||||||
|
dmg:SetDamagePosition(self.Owner:GetPos())
|
||||||
|
dmg:SetDamageType(DMG_CLUB)
|
||||||
|
|
||||||
|
hitEnt:DispatchTraceAttack(dmg, spos + (self.Owner:GetAimVector() * 3), sdest)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.Owner.LagCompensation and SERVER then
|
||||||
|
self.Owner:LagCompensation(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:SecondaryAttack()
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:GetClass()
|
||||||
|
return "jb_knife"
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:OnDrop()
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:DrawWeaponSelection(x, y, wide, tall, alpha)
|
||||||
|
|
||||||
|
draw.SimpleText(self.IconLetter, "CSSelectIcons", x + wide / 2, y + tall * 0.2, Color(255, 210, 0, 255), TEXT_ALIGN_CENTER)
|
||||||
|
-- Draw a CS:S select icon
|
||||||
|
|
||||||
|
self:PrintWeaponInfo(x + wide + 20, y + tall * 0.95, alpha)
|
||||||
|
-- Print weapon information
|
||||||
|
end
|
||||||
71
entities/weapons/weapon_jb_m4a1.lua
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
SWEP.PrintName = "M4A1"
|
||||||
|
|
||||||
|
SWEP.Slot = 1
|
||||||
|
SWEP.SlotPos = 1
|
||||||
|
|
||||||
|
SWEP.HoldType = "ar2"
|
||||||
|
SWEP.Base = "weapon_jb_base"
|
||||||
|
SWEP.Category = "Jailbreak Weapons"
|
||||||
|
|
||||||
|
SWEP.Spawnable = true
|
||||||
|
SWEP.AdminSpawnable = true
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_rif_m4a1.mdl"
|
||||||
|
SWEP.WorldModel = "models/weapons/w_rif_m4a1.mdl"
|
||||||
|
|
||||||
|
SWEP.Weight = 3
|
||||||
|
SWEP.AutoSwitchTo = true
|
||||||
|
SWEP.AutoSwitchFrom = false
|
||||||
|
|
||||||
|
SWEP.Primary.Sound = Sound("Weapon_M4A1.Single")
|
||||||
|
SWEP.Primary.Recoil = 1
|
||||||
|
SWEP.Primary.Damage = 30
|
||||||
|
SWEP.Primary.NumShots = 1
|
||||||
|
SWEP.Primary.Cone = 0.02
|
||||||
|
SWEP.Primary.ClipSize = 30
|
||||||
|
SWEP.Primary.Delay = 0.15
|
||||||
|
SWEP.Primary.DefaultClip = 60
|
||||||
|
SWEP.Primary.Automatic = true
|
||||||
|
SWEP.Primary.ShootConeAdd = 0.0065;
|
||||||
|
SWEP.Primary.Ammo = "smg1"
|
||||||
|
|
||||||
|
SWEP.FakeIronSights = true;
|
||||||
|
|
||||||
|
SWEP.Positions = {};
|
||||||
|
SWEP.Positions[1] = {pos = Vector(0,0,0), ang = Vector(0,0,0)};
|
||||||
|
SWEP.Positions[2] = {pos = Vector(-7.881, -1.181, 0.239), ang = Vector(2.799, -1.4, -4.6)};
|
||||||
|
SWEP.Positions[3] = {pos = Vector(6.534, -9, 0.708), ang = Vector(0,70,0)};
|
||||||
71
entities/weapons/weapon_jb_mac10.lua
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
|
||||||
|
SWEP.PrintName = "Mac 10"
|
||||||
|
|
||||||
|
|
||||||
|
SWEP.Slot = 1
|
||||||
|
SWEP.SlotPos = 1
|
||||||
|
|
||||||
|
SWEP.HoldType = "pistol"
|
||||||
|
SWEP.Base = "weapon_jb_base"
|
||||||
|
SWEP.Category = "Jailbreak Weapons"
|
||||||
|
|
||||||
|
SWEP.Spawnable = true
|
||||||
|
SWEP.AdminSpawnable = true
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_smg_mac10.mdl"
|
||||||
|
SWEP.WorldModel = "models/weapons/w_smg_mac10.mdl"
|
||||||
|
|
||||||
|
SWEP.Weight = 5
|
||||||
|
SWEP.AutoSwitchTo = true
|
||||||
|
SWEP.AutoSwitchFrom = false
|
||||||
|
|
||||||
|
SWEP.Primary.Sound = Sound( "Weapon_Mac10.Single" )
|
||||||
|
SWEP.Primary.Recoil = 0.5
|
||||||
|
SWEP.Primary.Damage = 19
|
||||||
|
SWEP.Primary.NumShots = 1
|
||||||
|
SWEP.Primary.Cone = 0.04
|
||||||
|
SWEP.Primary.ClipSize = 30
|
||||||
|
SWEP.Primary.Delay = 0.07
|
||||||
|
SWEP.Primary.DefaultClip = 100
|
||||||
|
SWEP.Primary.Automatic = true
|
||||||
|
SWEP.Primary.Ammo = "smg1"
|
||||||
|
SWEP.FakeIronSights = true;
|
||||||
|
|
||||||
|
SWEP.Positions = {};
|
||||||
|
SWEP.Positions[1] = {pos = Vector(0,0,0), ang = Vector(0,0,0)};
|
||||||
|
SWEP.Positions[2] = {pos = Vector(-9.32, -5.749, 2.759 ), ang = Vector(1.2, -5.401, -8.601)};
|
||||||
|
SWEP.Positions[3] = {pos = Vector(-5.119, -14.724, -13.938), ang = Vector(70, -1.93, -8.544)};
|
||||||
69
entities/weapons/weapon_jb_mp5navy.lua
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
SWEP.PrintName = "MP5"
|
||||||
|
|
||||||
|
|
||||||
|
SWEP.Slot = 1
|
||||||
|
SWEP.SlotPos = 1
|
||||||
|
;
|
||||||
|
SWEP.HoldType = "smg"
|
||||||
|
SWEP.Base = "weapon_jb_base"
|
||||||
|
SWEP.Category = "Jailbreak Weapons"
|
||||||
|
|
||||||
|
SWEP.Spawnable = true
|
||||||
|
SWEP.AdminSpawnable = true
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_smg_mp5.mdl"
|
||||||
|
SWEP.WorldModel = "models/weapons/w_smg_mp5.mdl"
|
||||||
|
|
||||||
|
SWEP.Weight = 3
|
||||||
|
SWEP.AutoSwitchTo = true
|
||||||
|
SWEP.AutoSwitchFrom = false
|
||||||
|
|
||||||
|
SWEP.Primary.Sound = Sound("Weapon_MP5Navy.Single")
|
||||||
|
SWEP.Primary.Recoil = 0.5
|
||||||
|
SWEP.Primary.Damage = 28
|
||||||
|
SWEP.Primary.NumShots = 1
|
||||||
|
SWEP.Primary.Cone = 0.02
|
||||||
|
SWEP.Primary.ClipSize = 30
|
||||||
|
SWEP.Primary.Delay = 0.11
|
||||||
|
SWEP.Primary.DefaultClip = 60
|
||||||
|
SWEP.Primary.Automatic = true
|
||||||
|
SWEP.Primary.Ammo = "smg1"
|
||||||
|
|
||||||
|
SWEP.Positions = {};
|
||||||
|
SWEP.Positions[1] = {pos = Vector(0,0,0), ang = Vector(0,0,0)};
|
||||||
|
SWEP.Positions[2] = {pos = Vector(-5.361, -2.757, 1.879), ang = Vector(1.2, 0, 0)};
|
||||||
|
SWEP.Positions[3] = {pos = Vector(6.377, -13.938, 0.393), ang = Vector(0,70,0)};
|
||||||
72
entities/weapons/weapon_jb_p90.lua
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
|
||||||
|
SWEP.PrintName = "P90"
|
||||||
|
|
||||||
|
|
||||||
|
SWEP.Slot = 1
|
||||||
|
SWEP.SlotPos = 1
|
||||||
|
|
||||||
|
SWEP.HoldType = "ar2"
|
||||||
|
SWEP.Base = "weapon_jb_base"
|
||||||
|
SWEP.Category = "Jailbreak Weapons"
|
||||||
|
|
||||||
|
SWEP.Spawnable = true
|
||||||
|
SWEP.AdminSpawnable = true
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_smg_p90.mdl"
|
||||||
|
SWEP.WorldModel = "models/weapons/w_smg_p90.mdl"
|
||||||
|
|
||||||
|
SWEP.Weight = 5
|
||||||
|
SWEP.AutoSwitchTo = true
|
||||||
|
SWEP.AutoSwitchFrom = false
|
||||||
|
|
||||||
|
SWEP.Primary.Sound = Sound( "Weapon_p90.Single" )
|
||||||
|
SWEP.Primary.Recoil = 0.6
|
||||||
|
SWEP.Primary.Damage = 15
|
||||||
|
SWEP.Primary.NumShots = 1
|
||||||
|
SWEP.Primary.Cone = 0.018
|
||||||
|
SWEP.Primary.ClipSize = 50
|
||||||
|
SWEP.Primary.Delay = 0.07
|
||||||
|
SWEP.Primary.DefaultClip = 100
|
||||||
|
SWEP.Primary.Automatic = true
|
||||||
|
SWEP.Primary.Ammo = "smg1"
|
||||||
|
|
||||||
|
SWEP.FakeIronSights = true;
|
||||||
|
|
||||||
|
SWEP.Positions = {};
|
||||||
|
SWEP.Positions[1] = {pos = Vector(0,0,0), ang = Vector(0,0,0)};
|
||||||
|
SWEP.Positions[2] = {pos = Vector(-5.72, -5.434, 1.84), ang = Vector(0,0,0)};
|
||||||
|
SWEP.Positions[3] = {pos = Vector(7.953, -12.992, -0.394), ang = Vector(0,70,0)};
|
||||||
109
entities/weapons/weapon_jb_scout.lua
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
if (CLIENT) then
|
||||||
|
scopeTex = surface.GetTextureID("scope/scope_normal")
|
||||||
|
end
|
||||||
|
|
||||||
|
SWEP.PrintName = "M40A1"
|
||||||
|
|
||||||
|
SWEP.Slot = 1
|
||||||
|
SWEP.SlotPos = 1
|
||||||
|
SWEP.HoldType = "ar2"
|
||||||
|
SWEP.Base = "weapon_jb_base"
|
||||||
|
SWEP.Category = "Jailbreak Weapons"
|
||||||
|
|
||||||
|
SWEP.Spawnable = true
|
||||||
|
SWEP.AdminSpawnable = true
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_snip_scout.mdl"
|
||||||
|
SWEP.WorldModel = "models/weapons/w_snip_scout.mdl"
|
||||||
|
|
||||||
|
SWEP.Weight = 3
|
||||||
|
SWEP.AutoSwitchTo = true
|
||||||
|
SWEP.AutoSwitchFrom = false
|
||||||
|
|
||||||
|
SWEP.Primary.Sound = Sound("Weapon_Scout.Single")
|
||||||
|
SWEP.Primary.Recoil = 2
|
||||||
|
SWEP.Primary.Damage = 90
|
||||||
|
SWEP.Primary.NumShots = 1
|
||||||
|
SWEP.Primary.Cone = 0.00001
|
||||||
|
SWEP.Primary.ClipSize = 6
|
||||||
|
SWEP.Primary.Delay = 1.1
|
||||||
|
SWEP.Primary.DefaultClip = 30
|
||||||
|
SWEP.Primary.Automatic = false
|
||||||
|
SWEP.Primary.Ammo = "smg1"
|
||||||
|
|
||||||
|
SWEP.Secondary.Automatic = false
|
||||||
|
SWEP.Secondary.ClipSize = -1
|
||||||
|
SWEP.Secondary.DefaultClip = -1
|
||||||
|
|
||||||
|
function SWEP:TranslateFOV(fov)
|
||||||
|
if self:GetNWMode() == 2 then
|
||||||
|
return 20
|
||||||
|
else
|
||||||
|
return fov
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if CLIENT then
|
||||||
|
|
||||||
|
function SWEP:AdjustMouseSensitivity()
|
||||||
|
return self:GetNWMode() == 2 and .20 or 1;
|
||||||
|
end
|
||||||
|
|
||||||
|
local scopeMat = Material("jailbreak_excl/scope.png");
|
||||||
|
|
||||||
|
function SWEP:DrawHUD()
|
||||||
|
if self:GetNWMode() == 2 then
|
||||||
|
|
||||||
|
local size = ScrH();
|
||||||
|
|
||||||
|
surface.SetDrawColor(JB.Color.black)
|
||||||
|
|
||||||
|
surface.DrawRect(0, 0, (ScrW()-size) / 2, size);
|
||||||
|
surface.DrawRect(ScrW() - ((ScrW()-size) / 2), 0, (ScrW()-size) / 2, size);
|
||||||
|
|
||||||
|
surface.DrawLine(0,ScrH()/2,ScrW(),ScrH()/2)
|
||||||
|
surface.DrawLine(ScrW()/2,0,ScrW()/2,ScrH())
|
||||||
|
|
||||||
|
surface.SetDrawColor(JB.Color.black)
|
||||||
|
surface.SetMaterial(scopeMat)
|
||||||
|
surface.DrawTexturedRect( (ScrW()/2) - (size/2) , 0, size, size)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
65
entities/weapons/weapon_jb_sg552.lua
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
SWEP.PrintName = "SG552"
|
||||||
|
|
||||||
|
SWEP.Slot = 1
|
||||||
|
SWEP.SlotPos = 1
|
||||||
|
|
||||||
|
SWEP.HoldType = "ar2"
|
||||||
|
SWEP.Base = "weapon_jb_base"
|
||||||
|
SWEP.Category = "Jailbreak Weapons"
|
||||||
|
|
||||||
|
SWEP.Spawnable = true
|
||||||
|
SWEP.AdminSpawnable = true
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_rif_sg552.mdl"
|
||||||
|
SWEP.WorldModel = "models/weapons/w_rif_sg552.mdl"
|
||||||
|
|
||||||
|
SWEP.Primary.Sound = Sound( "Weapon_SG552.Single" )
|
||||||
|
SWEP.Primary.Recoil = 0.5
|
||||||
|
SWEP.Primary.Damage = 28
|
||||||
|
SWEP.Primary.NumShots = 1
|
||||||
|
SWEP.Primary.Cone = 0.01
|
||||||
|
SWEP.Primary.ClipSize = 30
|
||||||
|
SWEP.Primary.Delay = 0.10
|
||||||
|
SWEP.Primary.DefaultClip = 90
|
||||||
|
SWEP.Primary.Automatic = true
|
||||||
|
SWEP.Primary.Ammo = "smg1"
|
||||||
|
|
||||||
|
|
||||||
|
SWEP.Positions = {};
|
||||||
|
SWEP.Positions[1] = {pos = Vector(0,0,0), ang = Vector(0,0,0)};
|
||||||
|
SWEP.Positions[2] = {pos = Vector(-7.04, -12.205, 3.599), ang = Vector(0.5, 1.899, 0)};
|
||||||
|
SWEP.Positions[3] = {pos = Vector(7.322, -20, 0), ang = Vector(0,70,0)};
|
||||||
73
entities/weapons/weapon_jb_tmp.lua
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
SWEP.PrintName = "TMP"
|
||||||
|
|
||||||
|
SWEP.Slot = 1
|
||||||
|
SWEP.SlotPos = 1
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
SWEP.HoldType = "pistol"
|
||||||
|
SWEP.Base = "weapon_jb_base"
|
||||||
|
SWEP.Category = "Jailbreak Weapons"
|
||||||
|
|
||||||
|
SWEP.Spawnable = true
|
||||||
|
SWEP.AdminSpawnable = true
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_smg_tmp.mdl"
|
||||||
|
SWEP.WorldModel = "models/weapons/w_smg_tmp.mdl"
|
||||||
|
|
||||||
|
SWEP.Weight = 3
|
||||||
|
SWEP.AutoSwitchTo = true
|
||||||
|
SWEP.AutoSwitchFrom = false
|
||||||
|
|
||||||
|
SWEP.Primary.Sound = Sound("Weapon_tmp.Single")
|
||||||
|
SWEP.Primary.Recoil = 0.6
|
||||||
|
SWEP.Primary.Damage = 25
|
||||||
|
SWEP.Primary.NumShots = 1
|
||||||
|
SWEP.Primary.Cone = 0.05
|
||||||
|
SWEP.Primary.ClipSize = 25
|
||||||
|
SWEP.Primary.Delay = 0.09
|
||||||
|
SWEP.Primary.DefaultClip = 50
|
||||||
|
SWEP.Primary.Automatic = true
|
||||||
|
SWEP.Primary.Ammo = "smg1"
|
||||||
|
|
||||||
|
SWEP.FakeIronSights = true;
|
||||||
|
|
||||||
|
|
||||||
|
SWEP.Positions = {};
|
||||||
|
SWEP.Positions[1] = {pos = Vector(0,0,0), ang = Vector(0,0,0)};
|
||||||
|
SWEP.Positions[2] = {pos = Vector(-6.72, 0, 2.64), ang = Vector(-0.401, 0.6, 0)};
|
||||||
|
SWEP.Positions[3] = {pos = Vector(7.322, -20, 0), ang = Vector(0,70,0)};
|
||||||
68
entities/weapons/weapon_jb_ump.lua
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
SWEP.PrintName = "UMP45"
|
||||||
|
|
||||||
|
SWEP.Slot = 1
|
||||||
|
SWEP.SlotPos = 1
|
||||||
|
|
||||||
|
SWEP.HoldType = "ar2"
|
||||||
|
SWEP.Base = "weapon_jb_base"
|
||||||
|
SWEP.Category = "Jailbreak Weapons"
|
||||||
|
|
||||||
|
SWEP.Spawnable = true
|
||||||
|
SWEP.AdminSpawnable = true
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_smg_ump45.mdl"
|
||||||
|
SWEP.WorldModel = "models/weapons/w_smg_ump45.mdl"
|
||||||
|
|
||||||
|
SWEP.Weight = 5
|
||||||
|
SWEP.AutoSwitchTo = true
|
||||||
|
SWEP.AutoSwitchFrom = false
|
||||||
|
|
||||||
|
SWEP.Primary.Sound = Sound( "Weapon_UMP45.Single" )
|
||||||
|
SWEP.Primary.Recoil = 0.5
|
||||||
|
SWEP.Primary.Damage = 28
|
||||||
|
SWEP.Primary.NumShots = 1
|
||||||
|
SWEP.Primary.Cone = 0.016
|
||||||
|
SWEP.Primary.ClipSize = 25
|
||||||
|
SWEP.Primary.Delay = 0.11
|
||||||
|
SWEP.Primary.DefaultClip = 90
|
||||||
|
SWEP.Primary.Automatic = true
|
||||||
|
SWEP.Primary.Ammo = "smg1"
|
||||||
|
|
||||||
|
SWEP.Positions = {};
|
||||||
|
SWEP.Positions[1] = {pos = Vector(0,0,0), ang = Vector(0,0,0)};
|
||||||
|
SWEP.Positions[2] = {pos = Vector(-8.761, -9.056, 4.119), ang = Vector(-1.3, -0.401, -3.401)};
|
||||||
|
SWEP.Positions[3] = {pos = Vector(8.739, -20, 0), ang = Vector(0,70,0)};
|
||||||
68
entities/weapons/weapon_jb_usp.lua
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
SWEP.PrintName = "H&K USP"
|
||||||
|
|
||||||
|
SWEP.Slot = 2
|
||||||
|
SWEP.SlotPos = 1
|
||||||
|
|
||||||
|
SWEP.HoldType = "revolver"
|
||||||
|
SWEP.Base = "weapon_jb_base"
|
||||||
|
SWEP.Category = "Jailbreak Weapons"
|
||||||
|
|
||||||
|
SWEP.Spawnable = true
|
||||||
|
SWEP.AdminSpawnable = true
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_pist_usp.mdl"
|
||||||
|
SWEP.WorldModel = "models/weapons/w_pist_usp.mdl"
|
||||||
|
|
||||||
|
SWEP.Weight = 1
|
||||||
|
SWEP.AutoSwitchTo = true
|
||||||
|
SWEP.AutoSwitchFrom = false
|
||||||
|
|
||||||
|
SWEP.Primary.Sound = Sound("Weapon_USP.Single")
|
||||||
|
SWEP.Primary.Recoil = 0.1
|
||||||
|
SWEP.Primary.Damage = 20
|
||||||
|
SWEP.Primary.NumShots = 1
|
||||||
|
SWEP.Primary.Cone = 0.02
|
||||||
|
SWEP.Primary.ClipSize = 12
|
||||||
|
SWEP.Primary.Delay = 0.05
|
||||||
|
SWEP.Primary.DefaultClip = 36
|
||||||
|
SWEP.Primary.Automatic = false
|
||||||
|
SWEP.Primary.Ammo = "pistol"
|
||||||
|
|
||||||
|
SWEP.Positions = {};
|
||||||
|
SWEP.Positions[1] = {pos = Vector(0,0,0), ang = Vector(0,0,0)};
|
||||||
|
SWEP.Positions[2] = {pos = Vector(-5.881, -7.481, 2.64), ang = Vector(0.1, 0.1, 0)};
|
||||||
|
SWEP.Positions[3] = {pos = Vector(0.079, -15.355, -20), ang = Vector(70, 0, 0)};
|
||||||
34
gamemode/cl_init.lua
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
include "sh_init.lua";
|
||||||
79
gamemode/classes/guard.lua
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
DEFINE_BASECLASS( "player_default" )
|
||||||
|
|
||||||
|
local PLAYER = {}
|
||||||
|
|
||||||
|
PLAYER.DisplayName = "Guard"
|
||||||
|
PLAYER.WalkSpeed = 260
|
||||||
|
PLAYER.RunSpeed = 325
|
||||||
|
PLAYER.CrouchedWalkSpeed = 0.4
|
||||||
|
PLAYER.DuckSpeed = 0.3
|
||||||
|
PLAYER.UnDuckSpeed = 0.3
|
||||||
|
PLAYER.JumpPower = 200
|
||||||
|
PLAYER.CanUseFlashlight = true
|
||||||
|
PLAYER.MaxHealth = 100
|
||||||
|
PLAYER.StartHealth = 100
|
||||||
|
PLAYER.StartArmor = 50
|
||||||
|
PLAYER.DropWeaponOnDie = true
|
||||||
|
PLAYER.AvoidPlayers = false
|
||||||
|
|
||||||
|
function PLAYER:Spawn()
|
||||||
|
self.Player:SetPlayerColor(Vector(.6,.9,1));
|
||||||
|
self.Player:SetWeaponColor(Vector(.6,.9,1));
|
||||||
|
end
|
||||||
|
|
||||||
|
local randomGuardSidearms = {"weapon_jb_deagle","weapon_jb_usp","weapon_jb_fiveseven"};
|
||||||
|
local randomGuardPrimary = {"weapon_jb_ak47","weapon_jb_aug","weapon_jb_galil","weapon_jb_m4a1","weapon_jb_mac10","weapon_jb_mp5navy","weapon_jb_p90","weapon_jb_scout","weapon_jb_sg552","weapon_jb_ump"};
|
||||||
|
function PLAYER:Loadout()
|
||||||
|
self.Player:Give("weapon_jb_fists");
|
||||||
|
|
||||||
|
self.Player:Give( table.Random( randomGuardSidearms ) )
|
||||||
|
self.Player:Give( table.Random( randomGuardPrimary ) );
|
||||||
|
self.Player:GiveAmmo( 255, "Pistol", true )
|
||||||
|
self.Player:GiveAmmo( 512, "SMG1", true )
|
||||||
|
end
|
||||||
|
|
||||||
|
function PLAYER:SetupDataTables()
|
||||||
|
self.Player:NetworkVar( "Bool", 1, "InGuardZone" );
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
util.PrecacheModel( "models/player/police.mdl" )
|
||||||
|
function PLAYER:SetModel()
|
||||||
|
self.Player:SetModel( "models/player/police.mdl" )
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
player_manager.RegisterClass( "player_guard", PLAYER, "player_default" )
|
||||||
144
gamemode/classes/prisoner.lua
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
DEFINE_BASECLASS( "player_default" )
|
||||||
|
|
||||||
|
local PLAYER = {}
|
||||||
|
|
||||||
|
PLAYER.DisplayName = "Prisoner"
|
||||||
|
PLAYER.WalkSpeed = 260
|
||||||
|
PLAYER.RunSpeed = 310
|
||||||
|
PLAYER.CrouchedWalkSpeed = 0.4
|
||||||
|
PLAYER.DuckSpeed = 0.3
|
||||||
|
PLAYER.UnDuckSpeed = 0.3
|
||||||
|
PLAYER.JumpPower = 200
|
||||||
|
PLAYER.CanUseFlashlight = false
|
||||||
|
PLAYER.MaxHealth = 100
|
||||||
|
PLAYER.StartHealth = 100
|
||||||
|
PLAYER.StartArmor = 50
|
||||||
|
PLAYER.DropWeaponOnDie = false
|
||||||
|
PLAYER.AvoidPlayers = false
|
||||||
|
|
||||||
|
function PLAYER:Spawn()
|
||||||
|
self.Player:SetPlayerColor(Vector(.9,.9,.9));
|
||||||
|
self.Player:SetWeaponColor(Vector(.9,.9,.9));
|
||||||
|
|
||||||
|
self.Player:SetRebel(false);
|
||||||
|
|
||||||
|
self.Player:GiveAmmo( 50, "Pistol", true )
|
||||||
|
self.Player:GiveAmmo( 100, "SMG1", true )
|
||||||
|
end
|
||||||
|
|
||||||
|
local randomSpecialWeapon = {
|
||||||
|
"weapon_jb_knife",
|
||||||
|
}
|
||||||
|
function PLAYER:Loadout()
|
||||||
|
self.Player:Give("weapon_jb_fists");
|
||||||
|
|
||||||
|
if math.random(1,JB.Config.prisonerSpecialChance) == 1 then
|
||||||
|
self.Player:Give(table.Random(randomSpecialWeapon)); -- give the player a rando waeapon from our table.
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function PLAYER:SetupDataTables()
|
||||||
|
self.Player:NetworkVar( "Bool", 0, "Rebel" );
|
||||||
|
|
||||||
|
self.Player:NetworkVar( "Bool", 1, "InGuardZone" );
|
||||||
|
end
|
||||||
|
|
||||||
|
local prisonerModels = {
|
||||||
|
Model("models/player/Group01/female_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_05.mdl"),
|
||||||
|
Model("models/player/Group01/male_01.mdl"),
|
||||||
|
Model("models/player/Group01/male_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_05.mdl"),
|
||||||
|
Model("models/player/Group01/male_01.mdl"),
|
||||||
|
Model("models/player/Group01/male_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_05.mdl"),
|
||||||
|
Model("models/player/Group01/male_01.mdl"),
|
||||||
|
Model("models/player/Group01/male_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_05.mdl"),
|
||||||
|
Model("models/player/Group01/male_01.mdl"),
|
||||||
|
Model("models/player/Group01/male_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_05.mdl"),
|
||||||
|
Model("models/player/Group01/male_01.mdl"),
|
||||||
|
Model("models/player/Group01/male_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_05.mdl"),
|
||||||
|
Model("models/player/Group01/male_01.mdl"),
|
||||||
|
Model("models/player/Group01/male_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_05.mdl"),
|
||||||
|
Model("models/player/Group01/male_01.mdl"),
|
||||||
|
Model("models/player/Group01/male_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_05.mdl"),
|
||||||
|
Model("models/player/Group01/male_01.mdl"),
|
||||||
|
Model("models/player/Group01/male_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_05.mdl"),
|
||||||
|
Model("models/player/Group01/male_01.mdl"),
|
||||||
|
Model("models/player/Group01/male_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_05.mdl"),
|
||||||
|
Model("models/player/Group01/male_01.mdl"),
|
||||||
|
Model("models/player/Group01/male_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_05.mdl"),
|
||||||
|
Model("models/player/Group01/male_01.mdl"),
|
||||||
|
Model("models/player/Group01/male_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_05.mdl"),
|
||||||
|
Model("models/player/Group01/male_01.mdl"),
|
||||||
|
Model("models/player/Group01/male_03.mdl"),
|
||||||
|
Model("models/player/Group01/female_02.mdl"),
|
||||||
|
Model("models/player/Group01/female_01.mdl"),
|
||||||
|
Model("models/player/Group01/female_04.mdl"),
|
||||||
|
Model("models/player/Group01/female_06.mdl"),
|
||||||
|
Model("models/player/Group01/male_02.mdl"),
|
||||||
|
Model("models/player/Group01/male_04.mdl"),
|
||||||
|
Model("models/player/Group01/male_05.mdl"),
|
||||||
|
Model("models/player/Group01/male_06.mdl"),
|
||||||
|
Model("models/player/Group01/male_07.mdl"),
|
||||||
|
Model("models/player/Group01/male_08.mdl"),
|
||||||
|
Model("models/player/Group01/male_09.mdl"),
|
||||||
|
}
|
||||||
|
function PLAYER:SetModel()
|
||||||
|
self.Player:SetModel( string.lower(table.Random(prisonerModels)) )
|
||||||
|
end
|
||||||
|
|
||||||
|
player_manager.RegisterClass( "player_prisoner", PLAYER, "player_default" )
|
||||||
42
gamemode/classes/spectator.lua
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
DEFINE_BASECLASS( "player_default" )
|
||||||
|
|
||||||
|
local PLAYER = {}
|
||||||
|
PLAYER.DisplayName = "Spectator"
|
||||||
|
PLAYER.WalkSpeed = 260
|
||||||
|
PLAYER.RunSpeed = 260
|
||||||
|
PLAYER.DuckSpeed = 1
|
||||||
|
|
||||||
|
player_manager.RegisterClass( "player_spectator", PLAYER, "player_default" )
|
||||||
196
gamemode/core/cl_context_menu.lua
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local matPointerBg = Material("jailbreak_excl/pointers/pointer_background.png");
|
||||||
|
local bubbles = {};
|
||||||
|
|
||||||
|
local popModelMatrix = cam.PopModelMatrix
|
||||||
|
local pushModelMatrix = cam.PushModelMatrix
|
||||||
|
local pushFilterMag = render.PushFilterMag;
|
||||||
|
local pushFilterMin = render.PushFilterMin;
|
||||||
|
local popFilterMag = render.PopFilterMag;
|
||||||
|
local popFilterMin = render.PopFilterMin;
|
||||||
|
local setColor = surface.SetDrawColor;
|
||||||
|
local setMaterial = surface.SetMaterial;
|
||||||
|
local drawTexturedRect = surface.DrawTexturedRect;
|
||||||
|
|
||||||
|
local matrix = Matrix()
|
||||||
|
local matrixScale = Vector(0, 0, 0)
|
||||||
|
local matrixTranslation = Vector(0, 0, 0)
|
||||||
|
local scale=1;
|
||||||
|
|
||||||
|
local size = 350;
|
||||||
|
|
||||||
|
local x,y,steps,mul;
|
||||||
|
|
||||||
|
local selection=0;
|
||||||
|
|
||||||
|
local contextEnabled = false;
|
||||||
|
|
||||||
|
local color=Color(255,255,255,0);
|
||||||
|
local color_black = Color(0,0,0,0);
|
||||||
|
hook.Add("HUDPaintOver","JB.HUDPaintOver.PaintContextMenu",function()
|
||||||
|
|
||||||
|
|
||||||
|
mul=FrameTime()*10;
|
||||||
|
|
||||||
|
scale = Lerp(mul,scale,contextEnabled and 1 or 0);
|
||||||
|
color.a = Lerp(mul,color.a,contextEnabled and 255 or 0)
|
||||||
|
color_black.a = color.a;
|
||||||
|
|
||||||
|
if (color.a < 1) then return end
|
||||||
|
|
||||||
|
x,y = ScrW()/2 - ((size + 128)*scale)/2,ScrH()/2 - ((size + 128)*scale)/2;
|
||||||
|
pushFilterMag( TEXFILTER.ANISOTROPIC )
|
||||||
|
pushFilterMin( TEXFILTER.ANISOTROPIC )
|
||||||
|
|
||||||
|
matrix=Matrix();
|
||||||
|
matrixTranslation.x = x;
|
||||||
|
matrixTranslation.y = y;
|
||||||
|
matrix:SetTranslation( matrixTranslation )
|
||||||
|
matrixScale.x = scale;
|
||||||
|
matrixScale.y = scale;
|
||||||
|
matrix:Scale( matrixScale )
|
||||||
|
|
||||||
|
steps = 2 * math.pi / #bubbles;
|
||||||
|
|
||||||
|
pushModelMatrix( matrix )
|
||||||
|
for k,v in pairs(bubbles)do
|
||||||
|
if not v.ang then v.ang = 0 end;
|
||||||
|
v.ang= Lerp(mul,v.ang,(math.pi + (k-1)*steps) % (2*math.pi));
|
||||||
|
|
||||||
|
x,y= (size + 64)/2 + math.sin(v.ang) * size/2,(size + 64)/2 + math.cos(v.ang) * size/2;
|
||||||
|
|
||||||
|
setMaterial(matPointerBg);
|
||||||
|
|
||||||
|
if not v.color then v.color = Color(50,50,50,0) end
|
||||||
|
|
||||||
|
v.color.a = color.a;
|
||||||
|
if v.selected then
|
||||||
|
v.color.r = Lerp(mul,v.color.r,255);
|
||||||
|
v.color.g = Lerp(mul,v.color.g,255);
|
||||||
|
v.color.b = Lerp(mul,v.color.b,255);
|
||||||
|
else
|
||||||
|
v.color.r = Lerp(mul,v.color.r,180);
|
||||||
|
v.color.g = Lerp(mul,v.color.g,180);
|
||||||
|
v.color.b = Lerp(mul,v.color.b,180);
|
||||||
|
end
|
||||||
|
|
||||||
|
setColor(v.color);
|
||||||
|
drawTexturedRect(x-32,y-32,128,128);
|
||||||
|
|
||||||
|
if v.icon then
|
||||||
|
setMaterial(v.icon);
|
||||||
|
drawTexturedRect(x+16,y+16,32,32);
|
||||||
|
end
|
||||||
|
draw.DrawText(v.text,"JBNormalShadow",x+32,y+64+14,color_black,1);
|
||||||
|
draw.DrawText(v.text,"JBNormal",x+32,y+64+14,color,1);
|
||||||
|
end
|
||||||
|
popModelMatrix()
|
||||||
|
popFilterMag()
|
||||||
|
popFilterMin()
|
||||||
|
|
||||||
|
end);
|
||||||
|
|
||||||
|
local xRel,yRel,ang;
|
||||||
|
hook.Add("Think","JB.Think.ContextMenuLogic",function()
|
||||||
|
if (color.a < 250) then return end
|
||||||
|
|
||||||
|
steps = 2 * math.pi / #bubbles;
|
||||||
|
|
||||||
|
xRel,yRel=(-ScrW()/2 + gui.MouseX()) + (size/2),(-ScrH()/2 + gui.MouseY()) + (size/2);
|
||||||
|
|
||||||
|
for k,v in pairs(bubbles)do
|
||||||
|
x,y= (size + 64)/2 + math.sin(v.ang) * size/2,(size + 64)/2 + math.cos(v.ang) * size/2;
|
||||||
|
|
||||||
|
if xRel > x-64 and xRel < x and yRel > y-64 and yRel < y then
|
||||||
|
v.selected = true;
|
||||||
|
else
|
||||||
|
v.selected = false;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end);
|
||||||
|
|
||||||
|
local function addBubble(text,icon,action)
|
||||||
|
local tab = {}
|
||||||
|
tab.icon = icon;
|
||||||
|
tab.text = text;
|
||||||
|
tab.action = action;
|
||||||
|
table.insert(bubbles,tab);
|
||||||
|
end
|
||||||
|
|
||||||
|
concommand.Add( "+menu_context",function()
|
||||||
|
if LocalPlayer().GetWarden and LocalPlayer():GetWarden() then
|
||||||
|
JB:DebugPrint("Opening context menu")
|
||||||
|
|
||||||
|
scale = 0;
|
||||||
|
color.a = 0;
|
||||||
|
|
||||||
|
bubbles = {};
|
||||||
|
|
||||||
|
addBubble("Move",Material("jailbreak_excl/pointers/generic.png"),function() RunConsoleCommand("jb_warden_placepointer","generic") end)
|
||||||
|
addBubble("Attack",Material("jailbreak_excl/pointers/exclamation.png"),function() RunConsoleCommand("jb_warden_placepointer","exclamation") end)
|
||||||
|
addBubble("Check out",Material("jailbreak_excl/pointers/question.png"),function() RunConsoleCommand("jb_warden_placepointer","question") end)
|
||||||
|
addBubble("Line up",Material("jailbreak_excl/pointers/line.png"),function() RunConsoleCommand("jb_warden_placepointer","line") end)
|
||||||
|
addBubble("Avoid",Material("jailbreak_excl/pointers/cross.png"),function() RunConsoleCommand("jb_warden_placepointer","cross") end)
|
||||||
|
addBubble("None",nil,function() RunConsoleCommand("jb_warden_placepointer","0") end)
|
||||||
|
|
||||||
|
gui.EnableScreenClicker(true);
|
||||||
|
contextEnabled = true;
|
||||||
|
|
||||||
|
end
|
||||||
|
end);
|
||||||
|
|
||||||
|
local function closeContext()
|
||||||
|
if not contextEnabled then return end
|
||||||
|
|
||||||
|
gui.EnableScreenClicker(false);
|
||||||
|
contextEnabled = false;
|
||||||
|
|
||||||
|
for k,v in pairs(bubbles)do
|
||||||
|
if v.selected then
|
||||||
|
v.action();
|
||||||
|
JB:DebugPrint("Selected option '"..v.text.."' in context menu.");
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
concommand.Add( "-menu_context",closeContext);
|
||||||
|
|
||||||
|
hook.Add("GUIMouseReleased","JB.GUIMouseReleased.ContextMenuMouse",function(mouse)
|
||||||
|
if mouse == MOUSE_LEFT and contextEnabled then
|
||||||
|
closeContext();
|
||||||
|
end
|
||||||
|
end);
|
||||||
116
gamemode/core/cl_draw_weapons.lua
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
local clientModels = {}
|
||||||
|
clientModels["weapon_jb_knife"] = ClientsideModel("models/weapons/w_knife_t.mdl");
|
||||||
|
if IsValid(clientModels["weapon_jb_knife"]) then
|
||||||
|
clientModels["weapon_jb_knife"]:SetNoDraw(true);
|
||||||
|
end
|
||||||
|
|
||||||
|
local primWeps = {"weapon_jb_weapon_jb_ak47","weapon_jb_awp","weapon_jb_m3","weapon_jb_m4a1","weapon_jb_mp5navy","weapon_jb_scout","weapon_jb_scout_ns","weapon_jb_tmp","weapon_jb_awp","weapon_jb_famas","weapon_jb_galil","weapon_jb_mac10","weapon_jb_p90","weapon_jb_sg552","weapon_jb_ump"};
|
||||||
|
local secoWeps = {"weapon_jb_deagle","weapon_jb_fiveseven","weapon_jb_glock","weapon_jb_usp"};
|
||||||
|
|
||||||
|
local wmeta = FindMetaTable("Weapon");
|
||||||
|
function wmeta:IsPrimary()
|
||||||
|
return (table.HasValue(primWeps,self:GetClass()) or table.HasValue(primWeps,weapons.Get(self:GetClass()).Base));
|
||||||
|
end
|
||||||
|
function wmeta:IsSecondary()
|
||||||
|
return (table.HasValue(secoWeps,self:GetClass()) or table.HasValue(secoWeps,weapons.Get(self:GetClass()).Base));
|
||||||
|
end
|
||||||
|
|
||||||
|
function GM:CheckWeaponTable(class,model)
|
||||||
|
if clientModels[class] then return end
|
||||||
|
|
||||||
|
timer.Simple(0,function()
|
||||||
|
clientModels[class] = ClientsideModel(model,RENDERGROUP_OPAQUE);
|
||||||
|
if IsValid(clientModels[class]) then
|
||||||
|
clientModels[class]:SetNoDraw(true);
|
||||||
|
end
|
||||||
|
end);
|
||||||
|
end
|
||||||
|
|
||||||
|
hook.Add("PostPlayerDraw","JB.PostPlayerDraw.DrawWeapons",function(p)
|
||||||
|
local weps = p:GetWeapons();
|
||||||
|
|
||||||
|
for k, v in pairs(weps)do
|
||||||
|
local mdl = clientModels[v:GetClass()];
|
||||||
|
if IsValid(mdl) and p:GetActiveWeapon() and p:GetActiveWeapon():IsValid() and p:GetActiveWeapon():GetClass() ~= v:GetClass() then
|
||||||
|
if v:IsSecondary() then
|
||||||
|
local boneindex = p:LookupBone("ValveBiped.Bip01_R_Thigh")
|
||||||
|
if boneindex then
|
||||||
|
local pos, ang = p:GetBonePosition(boneindex)
|
||||||
|
|
||||||
|
ang:RotateAroundAxis(ang:Forward(),90)
|
||||||
|
mdl:SetRenderOrigin(pos+(ang:Right()*4)+(ang:Up()*-4));
|
||||||
|
mdl:SetRenderAngles(ang);
|
||||||
|
mdl:DrawModel();
|
||||||
|
end
|
||||||
|
elseif v:IsPrimary() then
|
||||||
|
local boneindex = p:LookupBone("ValveBiped.Bip01_Spine2")
|
||||||
|
if boneindex then
|
||||||
|
local pos, ang = p:GetBonePosition(boneindex)
|
||||||
|
|
||||||
|
ang:RotateAroundAxis(ang:Forward(),0)
|
||||||
|
mdl:SetRenderOrigin(pos+(ang:Right()*4)+(ang:Up()*-7)+(ang:Forward()*6));
|
||||||
|
ang:RotateAroundAxis(ang:Right(),-15)
|
||||||
|
mdl:SetRenderAngles(ang);
|
||||||
|
mdl:DrawModel();
|
||||||
|
end
|
||||||
|
elseif v:GetClass() == "weapon_jb_knife" and not tobool(JB.Config.knivesAreConcealed) then
|
||||||
|
local boneindex = p:LookupBone("ValveBiped.Bip01_L_Thigh")
|
||||||
|
if boneindex then
|
||||||
|
local pos, ang = p:GetBonePosition(boneindex)
|
||||||
|
|
||||||
|
ang:RotateAroundAxis(ang:Forward(),90)
|
||||||
|
ang:RotateAroundAxis(ang:Right(),-90)
|
||||||
|
mdl:SetRenderOrigin(pos+(ang:Right()*-4.2)+(ang:Up()*2));
|
||||||
|
mdl:SetRenderAngles(ang);
|
||||||
|
mdl:DrawModel();
|
||||||
|
end
|
||||||
|
elseif string.Left(v:GetClass(),10) == "weapon_jb_grenade" then
|
||||||
|
local boneindex = p:LookupBone("ValveBiped.Bip01_L_Thigh")
|
||||||
|
if boneindex then
|
||||||
|
local pos, ang = p:GetBonePosition(boneindex)
|
||||||
|
|
||||||
|
ang:RotateAroundAxis(ang:Forward(),10)
|
||||||
|
ang:RotateAroundAxis(ang:Right(),90)
|
||||||
|
mdl:SetRenderOrigin(pos+(ang:Right()*-6.5)+(ang:Up()*-1));
|
||||||
|
mdl:SetRenderAngles(ang);
|
||||||
|
mdl:DrawModel();
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif not mdl and IsValid(v) and weapons.Get( v:GetClass( ) ) then
|
||||||
|
GAMEMODE:CheckWeaponTable( v:GetClass() ,
|
||||||
|
weapons.Get( v:GetClass( ) ).WorldModel );
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
117
gamemode/core/cl_fonts.lua
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
surface.CreateFont("JBExtraSmallShadow",{
|
||||||
|
font = JB.Config.font,
|
||||||
|
size = 11,
|
||||||
|
weight = 400,
|
||||||
|
blursize = 2,
|
||||||
|
})
|
||||||
|
surface.CreateFont("JBExtraSmall",{
|
||||||
|
font = JB.Config.font,
|
||||||
|
size = 11,
|
||||||
|
weight = 400
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
surface.CreateFont("JBSmallShadow",{
|
||||||
|
font = JB.Config.font,
|
||||||
|
size = 14,
|
||||||
|
weight =400,
|
||||||
|
blursize = 2,
|
||||||
|
})
|
||||||
|
surface.CreateFont("JBSmall",{
|
||||||
|
font = JB.Config.font,
|
||||||
|
size = 14,
|
||||||
|
weight = 400
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
surface.CreateFont("JBNormalShadow",{
|
||||||
|
font = JB.Config.font,
|
||||||
|
size = 18,
|
||||||
|
blursize = 2,
|
||||||
|
weight = 400
|
||||||
|
})
|
||||||
|
surface.CreateFont("JBNormal",{
|
||||||
|
font = JB.Config.font,
|
||||||
|
size = 18,
|
||||||
|
weight = 400
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
surface.CreateFont("JBLargeShadow",{
|
||||||
|
font = JB.Config.font,
|
||||||
|
size = 27,
|
||||||
|
weight = 400,
|
||||||
|
blursize = 2
|
||||||
|
})
|
||||||
|
surface.CreateFont("JBLarge",{
|
||||||
|
font = JB.Config.font,
|
||||||
|
size = 27,
|
||||||
|
weight = 400
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
surface.CreateFont("JBLargeBold",{
|
||||||
|
font = JB.Config.font,
|
||||||
|
size = 27,
|
||||||
|
weight = 600
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
surface.CreateFont("JBExtraLargeShadow",{
|
||||||
|
font = JB.Config.font,
|
||||||
|
size = 41,
|
||||||
|
weight = 400,
|
||||||
|
blursize = 2,
|
||||||
|
})
|
||||||
|
surface.CreateFont("JBExtraLarge",{
|
||||||
|
font = JB.Config.font,
|
||||||
|
size = 41,
|
||||||
|
weight = 400
|
||||||
|
})
|
||||||
|
|
||||||
|
surface.CreateFont("JBExtraExtraLargeShadow",{
|
||||||
|
font = JB.Config.font,
|
||||||
|
size = 64,
|
||||||
|
weight = 400,
|
||||||
|
blursize = 2,
|
||||||
|
})
|
||||||
|
surface.CreateFont("JBExtraExtraLarge",{
|
||||||
|
font = JB.Config.font,
|
||||||
|
size = 64,
|
||||||
|
weight = 400
|
||||||
|
})
|
||||||
445
gamemode/core/cl_hud.lua
Normal file
@@ -0,0 +1,445 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* HINTS FOR THE SPECTATOR HUD (up here for easy access) */
|
||||||
|
local Hints = {
|
||||||
|
"To initiate a last request, the last remaining prisoner can press F4 and choose from a number of different requests.",
|
||||||
|
"The last guard alive may kill all prisoners, unless at the point he becomes last guard there are under three prisoners alive.",
|
||||||
|
"The warden is the only guard who is allowed to give complicated commands, normal guards may only give simple commands (e.g. 'Move', 'Drop your weapon')",
|
||||||
|
"At the start of each round, the guards can claim the warden rank from the F4 menu.",
|
||||||
|
"The warden can hold C to place markers around the map.",
|
||||||
|
"Jail Break for Garry's Mod was created by Excl. Visit the developer's website at CasualBananas.com!",
|
||||||
|
"The warden can spawn various items and control certain options via the F4 menu.",
|
||||||
|
"Markers placed by the warden expire two minutes after being placed.",
|
||||||
|
"Respect your warden! Insulting your warden or disobeying orders will probably make him have you executed.",
|
||||||
|
"You are playing the official Jail Break for Garry's Mod, version 7, a complete remake of the gamemode we all have come to love.",
|
||||||
|
"Guards can run a little bit faster than prisoners. Make sure you only make your escape when nobody is looking!",
|
||||||
|
};
|
||||||
|
|
||||||
|
/* LIBRARIES */
|
||||||
|
local allPlayers=player.GetAll
|
||||||
|
|
||||||
|
local rad=math.rad;
|
||||||
|
local sin=JB.Util.memoize(math.sin);
|
||||||
|
local cos=JB.Util.memoize(math.cos);
|
||||||
|
local clamp=math.Clamp;
|
||||||
|
local round=math.Round;
|
||||||
|
local floor=math.floor;
|
||||||
|
local approach=math.Approach;
|
||||||
|
|
||||||
|
local noTexture=draw.NoTexture;
|
||||||
|
local roundedBox=draw.RoundedBox;
|
||||||
|
local drawText = draw.DrawText
|
||||||
|
|
||||||
|
local teamGetPlayers = team.GetPlayers;
|
||||||
|
|
||||||
|
local tableHasValue = table.HasValue;
|
||||||
|
|
||||||
|
local inputLookupBinding = input.LookupBinding;
|
||||||
|
|
||||||
|
local setDrawColor = surface.SetDrawColor;
|
||||||
|
local setMaterial = surface.SetMaterial;
|
||||||
|
local drawTexturedRect = surface.DrawTexturedRect;
|
||||||
|
local drawTexturedRectRotated = surface.DrawTexturedRectRotated;
|
||||||
|
local setFont = surface.SetFont;
|
||||||
|
local getTextSize = surface.GetTextSize;
|
||||||
|
local drawRect = surface.DrawRect;
|
||||||
|
|
||||||
|
local drawSimpleShadowText = JB.Util.drawSimpleShadowText;
|
||||||
|
|
||||||
|
|
||||||
|
/* VARIABLES */
|
||||||
|
local wardenMarkers = {}
|
||||||
|
wardenMarkers["generic"] = {text="Move",icon=Material("jailbreak_excl/pointers/generic.png")}
|
||||||
|
wardenMarkers["exclamation"] = {text="Attack",icon=Material("jailbreak_excl/pointers/exclamation.png")}
|
||||||
|
wardenMarkers["question"] = {text="Check out",icon=Material("jailbreak_excl/pointers/question.png")}
|
||||||
|
wardenMarkers["line"] = {text="Line up",icon=Material("jailbreak_excl/pointers/line.png")}
|
||||||
|
wardenMarkers["cross"] = {text="Avoid",icon=Material("jailbreak_excl/pointers/cross.png")}
|
||||||
|
|
||||||
|
local x,y,width,height; -- reusables;
|
||||||
|
local ply,dt,state,scrW,scrH; --predefined variables for every HUD loop
|
||||||
|
|
||||||
|
local yRestricted=-64;
|
||||||
|
|
||||||
|
// MATERIALS
|
||||||
|
local matHealth = Material("materials/jailbreak_excl/hud_health.png");
|
||||||
|
local matHealthBottom = Material("materials/jailbreak_excl/hud_health_bottom.png");
|
||||||
|
local matWarden = Material("materials/jailbreak_excl/hud_warden_bar.png");
|
||||||
|
local matTime = Material("materials/jailbreak_excl/hud_time.png");
|
||||||
|
local matLR = Material("materials/jailbreak_excl/lastrequest.png");
|
||||||
|
local matHint = Material("materials/jailbreak_excl/pointers/pointer_background.png");
|
||||||
|
local matQuestion = Material("materials/jailbreak_excl/pointers/question.png");
|
||||||
|
local matRestricted = Material("materials/jailbreak_excl/hud_restricted.png")
|
||||||
|
|
||||||
|
// COLORS
|
||||||
|
local color_marker = Color(255,255,255,0);
|
||||||
|
local color_marker_dark = Color(0,0,0,0);
|
||||||
|
|
||||||
|
// WARDEN PANEL
|
||||||
|
local warden;
|
||||||
|
vgui.Register("JBHUDWardenFrame",{
|
||||||
|
Init = function(self)
|
||||||
|
self:SetSize(256,64);
|
||||||
|
self:SetPos(ScrW() - self:GetWide() - 16,32);
|
||||||
|
self.Player = NULL;
|
||||||
|
|
||||||
|
self.Avatar = vgui.Create( "AvatarImage", self )
|
||||||
|
self.Avatar:SetSize( 32,32 )
|
||||||
|
self.Avatar:SetPos( 13,16 )
|
||||||
|
|
||||||
|
end,
|
||||||
|
SetPlayer = function(self,ply)
|
||||||
|
if not IsValid(ply) then return end
|
||||||
|
|
||||||
|
self.Player = ply
|
||||||
|
self.Avatar:SetPlayer( ply, 32 )
|
||||||
|
end,
|
||||||
|
PaintOver = function(self,w,h)
|
||||||
|
setDrawColor(JB.Color.white);
|
||||||
|
setMaterial(matWarden);
|
||||||
|
drawTexturedRect(0,0,256,64);
|
||||||
|
|
||||||
|
if IsValid(self.Player) then
|
||||||
|
//draw.SimpleText(self.Player:Nick(),"JBNormalShadow",62,h/2,JB.Color.black,0,1);
|
||||||
|
drawSimpleShadowText(self.Player:Nick(),"JBNormal",62,h/2,JB.Color.white,0,1);
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},"Panel");
|
||||||
|
hook.Add("Think","JB.Think.PredictWardenFrame",function()
|
||||||
|
if IsValid(warden) and (not IsValid(JB:GetWarden()) or warden.Player ~= JB:GetWarden()) then
|
||||||
|
warden:Remove();
|
||||||
|
warden=nil;
|
||||||
|
end
|
||||||
|
|
||||||
|
if IsValid(JB:GetWarden()) and not IsValid(warden) then
|
||||||
|
warden=vgui.Create("JBHUDWardenFrame");
|
||||||
|
warden:SetPlayer(JB:GetWarden());
|
||||||
|
|
||||||
|
notification.AddLegacy(warden.Player:Nick().." is the warden",NOTICE_GENERIC);
|
||||||
|
end
|
||||||
|
end);
|
||||||
|
|
||||||
|
// UTILITY FUNCTIONS
|
||||||
|
local r;
|
||||||
|
local function drawHealth(x,y,w,radius,amt)
|
||||||
|
for a = amt, amt + 180 * amt / 100 do
|
||||||
|
r=rad(a)* 2
|
||||||
|
drawTexturedRectRotated(x / 2 + cos(r) * radius, y / 2 - sin(r) * radius, w,10, a * 2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local function convertTime(t)
|
||||||
|
if t < 0 then
|
||||||
|
t = 0;
|
||||||
|
end
|
||||||
|
|
||||||
|
local sec = tostring( round(t - floor(t/60)*60));
|
||||||
|
if string.len(sec) < 2 then
|
||||||
|
sec = "0"..sec;
|
||||||
|
end
|
||||||
|
return (tostring( floor(t/60) ).." : "..sec )
|
||||||
|
end
|
||||||
|
|
||||||
|
// Health and ammo
|
||||||
|
local healthMemory = 0;
|
||||||
|
local health = 0;
|
||||||
|
local wide_hp_1,wide_hp_2,height_hp;
|
||||||
|
local activeWeapon;
|
||||||
|
local text_ammo;
|
||||||
|
local drawAmmoHealth = function()
|
||||||
|
health= clamp(ply:Health(),0,100);
|
||||||
|
healthMemory = approach(healthMemory,health,dt*50);
|
||||||
|
health=tostring(health);
|
||||||
|
|
||||||
|
setDrawColor(JB.Color.white);
|
||||||
|
setMaterial(matHealthBottom);
|
||||||
|
drawTexturedRect(0,0,256,256);
|
||||||
|
|
||||||
|
noTexture();
|
||||||
|
setDrawColor(JB.Color["#CF1000"]);
|
||||||
|
|
||||||
|
drawHealth(256,256,24,86,healthMemory);
|
||||||
|
|
||||||
|
setFont("JBExtraLarge");
|
||||||
|
wide_hp_1,height = getTextSize(health);
|
||||||
|
setFont("JBSmall");
|
||||||
|
wide_hp_2 = getTextSize(" %\n HP");
|
||||||
|
|
||||||
|
activeWeapon = ply:GetActiveWeapon();
|
||||||
|
|
||||||
|
if IsValid(activeWeapon) and activeWeapon:Clip1() ~= -1 and activeWeapon:GetClass() ~= "weapon_gravgun" then
|
||||||
|
y = 64+32+12;
|
||||||
|
|
||||||
|
drawSimpleShadowText(health,"JBExtraLarge",128-(wide_hp_1 + wide_hp_2)/2,y-height/2 - 6,JB.Color["#DCDCDC"],0,0);
|
||||||
|
drawText(" %\n HP ","JBSmallShadow",128-(wide_hp_1 + wide_hp_2)/2 + wide_hp_1,y-height/2,JB.Color.black,0,0);
|
||||||
|
drawText(" %\n HP ","JBSmall",128-(wide_hp_1 + wide_hp_2)/2 + wide_hp_1,y-height/2,JB.Color["#DCDCDC"],0,0);
|
||||||
|
|
||||||
|
setDrawColor(JB.Color["#DCDCDC"]);
|
||||||
|
drawRect(128-40,128-2,1 + clamp(79 * (tonumber(ply:GetActiveWeapon():Clip1())/tonumber(ply:GetActiveWeapon().Primary and ply:GetActiveWeapon().Primary.ClipSize or 10)),0,79),4);
|
||||||
|
|
||||||
|
y = 128+16;
|
||||||
|
text_ammo = ply:GetActiveWeapon():Clip1() .. "/" .. ply:GetAmmoCount(ply:GetActiveWeapon():GetPrimaryAmmoType());
|
||||||
|
|
||||||
|
drawSimpleShadowText("AMMO","JBExtraSmall",128-40,y,JB.Color["#DCDCDC"],0,1);
|
||||||
|
drawSimpleShadowText(text_ammo,"JBNormal",128+40,y,JB.Color["#DCDCDC"],2,1);
|
||||||
|
else
|
||||||
|
drawSimpleShadowText(health,"JBExtraLarge",128-(wide_hp_1 + wide_hp_2)/2,128-height/2 - 6,JB.Color["#DCDCDC"],0,0);
|
||||||
|
drawText(" %\n HP ","JBSmallShadow",128-(wide_hp_1 + wide_hp_2)/2 + wide_hp_1,128-height/2,JB.Color.black,0,0);
|
||||||
|
drawText(" %\n HP ","JBSmall",128-(wide_hp_1 + wide_hp_2)/2 + wide_hp_1,128-height/2,JB.Color["#DCDCDC"],0,0);
|
||||||
|
end
|
||||||
|
|
||||||
|
setDrawColor(JB.Color.white);
|
||||||
|
setMaterial(matHealth);
|
||||||
|
drawTexturedRect(0,0,256,256);
|
||||||
|
end
|
||||||
|
|
||||||
|
// Spectator
|
||||||
|
local specPosScreen,plySpec,players;
|
||||||
|
local hint;
|
||||||
|
local color_hint_questionmark = Color(255,255,255,0);
|
||||||
|
local colorHintMakeZero = false;
|
||||||
|
local newHint = function()
|
||||||
|
setFont("JBSmall");
|
||||||
|
hint=string.Explode("\n",JB.Util.formatLine(Hints[math.random(1,#Hints)],512-(128-16)),false);
|
||||||
|
colorHintMakeZero=true;
|
||||||
|
end
|
||||||
|
newHint();
|
||||||
|
local drawSpectatorHUD = function()
|
||||||
|
players=allPlayers();
|
||||||
|
|
||||||
|
for i=1, #players do
|
||||||
|
plySpec=players[i];
|
||||||
|
if plySpec:Alive() and (plySpec:Team() == TEAM_GUARD or plySpec:Team() == TEAM_PRISONER) then
|
||||||
|
specPosScreen = (plySpec:EyePos() + Vector(0,0,20)):ToScreen();
|
||||||
|
x,y=specPosScreen.x,specPosScreen.y;
|
||||||
|
specPosScreen = nil;
|
||||||
|
|
||||||
|
local alpha = 50;
|
||||||
|
if ply:EyePos():Distance( plySpec:GetPos() ) < 1000 then
|
||||||
|
alpha = 255;
|
||||||
|
end
|
||||||
|
|
||||||
|
drawSimpleShadowText(plySpec:Nick(),"JBNormal",x,y,Color(255,255,255,alpha),1,1);
|
||||||
|
|
||||||
|
local col = table.Copy(JB.Color["#CF1000"]);
|
||||||
|
col.a = alpha;
|
||||||
|
|
||||||
|
roundedBox(2,x - 30,y + 10,60,4,Color(0,0,0,alpha));
|
||||||
|
roundedBox(0,x - 30 + 1,y + 10 + 1,(60-2)*clamp(plySpec:Health()/100,0,1),2,col);
|
||||||
|
roundedBox(0,x - 30 + 1,y + 10 + 1,(60-2)*clamp(plySpec:Health()/100,0,1),1,Color(255,255,255,15 * alpha/255));
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
//hint
|
||||||
|
x,y=scrW/2 - 256,scrH-128;
|
||||||
|
|
||||||
|
setDrawColor(JB.Color.white);
|
||||||
|
setMaterial(matHint);
|
||||||
|
drawTexturedRect(x,y,128,128);
|
||||||
|
|
||||||
|
color_hint_questionmark.a = Lerp(colorHintMakeZero and dt*20 or dt*5,color_hint_questionmark.a,colorHintMakeZero and 0 or 255);
|
||||||
|
if colorHintMakeZero and color_hint_questionmark.a < 1 then
|
||||||
|
colorHintMakeZero = false;
|
||||||
|
end
|
||||||
|
setDrawColor(color_hint_questionmark);
|
||||||
|
setMaterial(matQuestion);
|
||||||
|
drawTexturedRect(x+32+16,y+32+16,32,32);
|
||||||
|
|
||||||
|
x,y = x+128-8,y+30;
|
||||||
|
width,height = drawSimpleShadowText("Did you know?","JBNormal",x,y,JB.Color.white,0,0);
|
||||||
|
y=y+height+2;
|
||||||
|
|
||||||
|
for i=1,#hint do
|
||||||
|
width,height=drawSimpleShadowText(hint[i],"JBSmall",x,y,JB.Color["#eee"],0,0);
|
||||||
|
y=y+height;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
timer.Create("JB.HUD.NewHint",8,0,newHint);
|
||||||
|
|
||||||
|
// TIMER
|
||||||
|
local drawTimer = function()
|
||||||
|
y = 32;
|
||||||
|
if IsValid(warden) then
|
||||||
|
y = warden.y + warden:GetTall();
|
||||||
|
end
|
||||||
|
|
||||||
|
setDrawColor(JB.Color.white);
|
||||||
|
setMaterial(matTime);
|
||||||
|
drawTexturedRect(scrW-16-128,y,128,64);
|
||||||
|
|
||||||
|
local timerText = state == STATE_IDLE and "WAITING" or state == STATE_ENDED and "ENDED" or state == STATE_MAPVOTE and "MAPVOTE" or
|
||||||
|
convertTime(60*(state == STATE_LASTREQUEST and 3 or 10) - (CurTime() - JB.RoundStartTime));
|
||||||
|
|
||||||
|
drawSimpleShadowText(timerText,"JBNormal",scrW-16-64,y+32,JB.Color.white,1,1);
|
||||||
|
end
|
||||||
|
|
||||||
|
// LAST REQUEST
|
||||||
|
local lrGuard,lrPrisoner;
|
||||||
|
local drawLastRequest = function()
|
||||||
|
setMaterial(matLR)
|
||||||
|
setDrawColor(JB.Color.white)
|
||||||
|
|
||||||
|
drawTexturedRect(scrW/2 - 256, 4,512,128);
|
||||||
|
|
||||||
|
-- unpack from table;
|
||||||
|
lrGuard,lrPrisoner = unpack(JB.LastRequestPlayers);
|
||||||
|
|
||||||
|
-- convert to string
|
||||||
|
lrGuard = IsValid(lrGuard) and lrGuard:Nick() or "ERROR!";
|
||||||
|
lrPrisoner = IsValid(lrPrisoner) and lrPrisoner:Nick() or "ERROR!";
|
||||||
|
|
||||||
|
drawSimpleShadowText(lrPrisoner,"JBNormal",scrW/2 + 28, 4 + 64,JB.Color.white,0,1);
|
||||||
|
drawSimpleShadowText(lrGuard,"JBNormal",scrW/2 - 28, 4 + 64,JB.Color.white,2,1);
|
||||||
|
end
|
||||||
|
|
||||||
|
// POINTER
|
||||||
|
local posMarkerScreen,marker;
|
||||||
|
local drawWardenPointer = function()
|
||||||
|
posMarkerScreen = (JB.TRANSMITTER:GetJBWarden_PointerPos()):ToScreen();
|
||||||
|
|
||||||
|
x = clamp(posMarkerScreen.x,32,scrW-64);
|
||||||
|
y = clamp(posMarkerScreen.y,32,scrH-64) - 8;
|
||||||
|
|
||||||
|
marker= wardenMarkers[JB.TRANSMITTER:GetJBWarden_PointerType()];
|
||||||
|
|
||||||
|
color_marker.a = (posMarkerScreen.x ~= x or posMarkerScreen.y ~= y+8) and 100 or 255;
|
||||||
|
color_marker_dark.a = color_marker.a;
|
||||||
|
setMaterial(marker.icon);
|
||||||
|
|
||||||
|
setDrawColor(color_marker);
|
||||||
|
drawTexturedRect(x-16,y-16,32,32);
|
||||||
|
|
||||||
|
drawSimpleShadowText(marker.text,"JBNormal",x,y+16,color_marker,1,0);
|
||||||
|
|
||||||
|
// note: 64unit = 1.22meters
|
||||||
|
drawSimpleShadowText(tostring(math.floor(LocalPlayer():EyePos():Distance(JB.TRANSMITTER:GetJBWarden_PointerPos()) * 1.22/64)).."m","JBSmall",x,y+34,color_marker,1,0);
|
||||||
|
end
|
||||||
|
|
||||||
|
// GM HOOK
|
||||||
|
local hookCall = hook.Call;
|
||||||
|
JB.Gamemode.HUDPaint = function(gm)
|
||||||
|
ply = LocalPlayer();
|
||||||
|
|
||||||
|
if not IsValid(ply) then return end
|
||||||
|
|
||||||
|
scrW,scrH,dt=ScrW(),ScrH(),FrameTime();
|
||||||
|
|
||||||
|
state = JB.State;
|
||||||
|
|
||||||
|
if ply:Alive() then
|
||||||
|
drawAmmoHealth(); // alive and well
|
||||||
|
|
||||||
|
-- ES support
|
||||||
|
if ES and ES.NotificationOffset then
|
||||||
|
ES.NotificationOffset.x = 24
|
||||||
|
ES.NotificationOffset.y = 232
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
drawSpectatorHUD(); // Spectator or dead.
|
||||||
|
|
||||||
|
-- ES support
|
||||||
|
if ES and ES.NotificationOffset then
|
||||||
|
ES.NotificationOffset.x = 24
|
||||||
|
ES.NotificationOffset.y = 24
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
drawTimer();
|
||||||
|
|
||||||
|
if JB.State == STATE_LASTREQUEST and JB.LastRequest ~= "0" then
|
||||||
|
drawLastRequest();
|
||||||
|
end
|
||||||
|
|
||||||
|
if #teamGetPlayers(TEAM_GUARD) < 1 or #teamGetPlayers(TEAM_PRISONER) < 1 then
|
||||||
|
drawText("A new round can not start until there is at least one player on both teams.\nWait for somebody to join the empty team.","JBNormalShadow",scrW/2,scrH * .6,JB.Color.black,1,1);
|
||||||
|
drawText("A new round can not start until there is at least one player on both teams.\nWait for somebody to join the empty team.","JBNormal",scrW/2,scrH * .6,JB.Color.white,1,1);
|
||||||
|
end
|
||||||
|
|
||||||
|
if IsValid(JB.TRANSMITTER) and JB.TRANSMITTER:GetJBWarden_PointerPos() and JB.TRANSMITTER:GetJBWarden_PointerType() and wardenMarkers[JB.TRANSMITTER:GetJBWarden_PointerType()] then
|
||||||
|
drawWardenPointer();
|
||||||
|
end
|
||||||
|
|
||||||
|
JB.Gamemode:HUDDrawTargetID(); -- not calling hook, we don't want any addons messing with this.
|
||||||
|
hookCall("HUDPaintOver",JB.Gamemode)
|
||||||
|
end;
|
||||||
|
|
||||||
|
// TARGET ID
|
||||||
|
local uniqueid,ent,text_x,text_y,text,text_sub,text_wide,text_tall,text_color;
|
||||||
|
JB.Gamemode.HUDDrawTargetID = function()
|
||||||
|
if LocalPlayer():GetObserverMode() ~= OBS_MODE_NONE then return end
|
||||||
|
|
||||||
|
ent = LocalPlayer():GetEyeTrace().Entity;
|
||||||
|
|
||||||
|
if (not IsValid(ent) ) then return end;
|
||||||
|
|
||||||
|
text = "ERROR"
|
||||||
|
text_sub = "Something went terribly wrong!";
|
||||||
|
|
||||||
|
if (ent:IsPlayer()) then
|
||||||
|
text = ent:Nick()
|
||||||
|
text_sub = ent:GetPos():Distance(LocalPlayer():EyePos()) < 200 and (ent:Health().."% HP"..(ent.GetRebel and ent:GetRebel() and " | Rebel" or ent.GetWarden and ent:GetWarden() and " | Warden" or ""));
|
||||||
|
text_color = team.GetColor(ent:Team());
|
||||||
|
elseif (ent:IsWeapon()) then
|
||||||
|
local tab=weapons.Get(ent:GetClass())
|
||||||
|
text = tab and tab.PrintName or ent:GetClass();
|
||||||
|
if( tableHasValue(JB.LastRequestPlayers,LocalPlayer()) and JB.LastRequestTypes[JB.LastRequest] and not JB.LastRequestTypes[JB.LastRequest]:GetCanPickupWeapons() ) then
|
||||||
|
text_sub = "Can not pick up in LR";
|
||||||
|
else
|
||||||
|
local bind = inputLookupBinding("+use");
|
||||||
|
text_sub = ent:GetPos():Distance(LocalPlayer():EyePos()) > 200 and "" or ((not bind) and "Bind a key to +use to pick up") or ("Press "..bind.." to pick up");
|
||||||
|
end
|
||||||
|
|
||||||
|
text_color = JB.Color.white;
|
||||||
|
else
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
text_x,text_y = scrW/2, scrH *.6;
|
||||||
|
drawSimpleShadowText(text,"JBNormal",text_x,text_y,text_color,1,1);
|
||||||
|
|
||||||
|
if text_sub and text_sub ~= "" then
|
||||||
|
|
||||||
|
setFont("JBNormal");
|
||||||
|
text_wide,text_tall = getTextSize(text);
|
||||||
|
|
||||||
|
text_y = text_y + text_tall*.9;
|
||||||
|
|
||||||
|
drawSimpleShadowText(text_sub,"JBSmall",text_x,text_y,JB.Color.white,1,1);
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function JB.Gamemode:HUDShouldDraw(element)
|
||||||
|
return (element ~= "CHudHealth" and element ~= "CHudBattery" and element ~= "CHudAmmo" and element ~= "CHudSecondaryAmmo" and element ~= "CHudMessage" and element ~= "CHudWeapon");
|
||||||
|
end
|
||||||
144
gamemode/core/cl_hud_lrready.lua
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local timeReceive;
|
||||||
|
local lrType = "BUG"
|
||||||
|
net.Receive('JB.LR.GetReady',function()
|
||||||
|
timeReceive=CurTime();
|
||||||
|
lrType = net.ReadString();
|
||||||
|
end);
|
||||||
|
|
||||||
|
local _Material = Material( "pp/toytown-top" )
|
||||||
|
_Material:SetTexture( "$fbtexture", render.GetScreenEffectTexture() )
|
||||||
|
|
||||||
|
/* HUD elements */
|
||||||
|
local drawText = draw.DrawText
|
||||||
|
local setColor = surface.SetTextColor
|
||||||
|
local setTextPos = surface.SetTextPos
|
||||||
|
local popModelMatrix = cam.PopModelMatrix
|
||||||
|
local pushModelMatrix = cam.PushModelMatrix
|
||||||
|
local pushFilterMag = render.PushFilterMag;
|
||||||
|
local pushFilterMin = render.PushFilterMin;
|
||||||
|
local popFilterMag = render.PopFilterMag;
|
||||||
|
local popFilterMin = render.PopFilterMin;
|
||||||
|
local getTextSize = surface.GetTextSize;
|
||||||
|
local setFont = surface.SetFont;
|
||||||
|
|
||||||
|
local sin=JB.Util.memoize(math.sin);
|
||||||
|
local cos=JB.Util.memoize(math.cos);
|
||||||
|
local deg2rad=math.rad;
|
||||||
|
local floor=math.floor;
|
||||||
|
|
||||||
|
local matrix = Matrix()
|
||||||
|
local matrixAngle = Angle(0, 0, 0)
|
||||||
|
local matrixScale = Vector(0, 0, 0)
|
||||||
|
local matrixTranslation = Vector(0, 0, 0)
|
||||||
|
local textWidth, textHeight, rad,textWidthSub,textHeightSub,width,height;
|
||||||
|
local halvedPi = math.pi/2;
|
||||||
|
local color=Color(255,255,255,255);
|
||||||
|
local color_dark=Color(0,0,0,255);
|
||||||
|
local clamp = math.Clamp;
|
||||||
|
local scale=1;
|
||||||
|
local ang = 0;
|
||||||
|
local text = function( text,sub )
|
||||||
|
|
||||||
|
x,y = ScrW()/2,ScrH()/2;
|
||||||
|
pushFilterMag( TEXFILTER.ANISOTROPIC )
|
||||||
|
pushFilterMin( TEXFILTER.ANISOTROPIC )
|
||||||
|
|
||||||
|
setFont("JBExtraExtraLarge");
|
||||||
|
textWidth, textHeight = getTextSize( text )
|
||||||
|
if sub then
|
||||||
|
setFont("JBNormal");
|
||||||
|
sub = JB.Util.formatLine(sub,ScrW()*.3)
|
||||||
|
textWidthSub, textHeightSub = getTextSize( sub );
|
||||||
|
textHeight=textHeight+textHeightSub;
|
||||||
|
|
||||||
|
if textWidthSub > textWidth then
|
||||||
|
width = textWidthSub;
|
||||||
|
else
|
||||||
|
width=textWidth;
|
||||||
|
end
|
||||||
|
|
||||||
|
height=(textHeight+textHeightSub);
|
||||||
|
else
|
||||||
|
width=textWidth;
|
||||||
|
height=textHeight;
|
||||||
|
end
|
||||||
|
|
||||||
|
rad = -deg2rad( ang )
|
||||||
|
x = x - ( sin( rad + halvedPi ) * width*scale / 2 + sin( rad ) * height*scale / 2 )
|
||||||
|
y = y - ( cos( rad + halvedPi ) * width*scale / 2 + cos( rad ) * height*scale / 2 )
|
||||||
|
|
||||||
|
matrix=Matrix();
|
||||||
|
matrixAngle.y = ang;
|
||||||
|
matrix:SetAngles( matrixAngle )
|
||||||
|
matrixTranslation.x = x;
|
||||||
|
matrixTranslation.y = y;
|
||||||
|
matrix:SetTranslation( matrixTranslation )
|
||||||
|
matrixScale.x = scale;
|
||||||
|
matrixScale.y = scale;
|
||||||
|
matrix:Scale( matrixScale )
|
||||||
|
pushModelMatrix( matrix )
|
||||||
|
drawText( text,"JBExtraExtraLargeShadow", sub and (width/2 - textWidth/2) or 0,0,color_dark,0);
|
||||||
|
drawText( text,"JBExtraExtraLarge", sub and (width/2 - textWidth/2) or 0,0,color,0);
|
||||||
|
if sub then
|
||||||
|
drawText(sub,"JBNormalShadow",width/2,textHeight,color_dark,1);
|
||||||
|
drawText(sub,"JBNormal",width/2,textHeight,color,1);
|
||||||
|
end
|
||||||
|
|
||||||
|
popModelMatrix()
|
||||||
|
popFilterMag()
|
||||||
|
popFilterMin()
|
||||||
|
end
|
||||||
|
|
||||||
|
local time,xCenter,yCenter;
|
||||||
|
hook.Add("HUDPaintOver","JB.HUDPaintOver.PaintReadyForLR",function()
|
||||||
|
if not timeReceive or (CurTime() - timeReceive) > 8 or not JB.LastRequestTypes[lrType] then return end
|
||||||
|
|
||||||
|
|
||||||
|
time=(CurTime() - timeReceive);
|
||||||
|
|
||||||
|
if time > 4 then
|
||||||
|
scale=.2 + (1-(time%1)) * 3
|
||||||
|
ang=-10 + (1-(time%1)) * 30;
|
||||||
|
else
|
||||||
|
scale=1;
|
||||||
|
ang=0;
|
||||||
|
end
|
||||||
|
|
||||||
|
time=floor(time);
|
||||||
|
|
||||||
|
text(time < 4 and JB.LastRequestTypes[lrType].name or time == 7 and "Go!" or tostring(3 - (time-4)), time < 4 and JB.LastRequestTypes[lrType].description);
|
||||||
|
end);
|
||||||
221
gamemode/core/cl_hud_weaponselection.lua
Normal file
@@ -0,0 +1,221 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local selectedTab = 0;
|
||||||
|
local c = 0;
|
||||||
|
local slots = {}
|
||||||
|
local slotPos = 1;
|
||||||
|
local function ArrangeSlots()
|
||||||
|
slots = {};
|
||||||
|
c = 0;
|
||||||
|
for k,v in pairs(LocalPlayer():GetWeapons())do
|
||||||
|
if v.Slot then
|
||||||
|
if not slots[v.Slot+1] then
|
||||||
|
slots[v.Slot+1] = {}
|
||||||
|
end
|
||||||
|
slots[v.Slot+1][#slots[v.Slot+1]+1] = v;
|
||||||
|
if v.Slot == 3 then
|
||||||
|
c = c+1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if selectedTab == 4 then
|
||||||
|
slotPos = (((slotPos-1)%c)+1);
|
||||||
|
else
|
||||||
|
slotPos = 1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
surface.CreateFont("JBWeaponSelectionFont",{
|
||||||
|
font = JB.Config.font,
|
||||||
|
size = 28,
|
||||||
|
})
|
||||||
|
surface.CreateFont("JBWeaponSelectionFontBlur",{
|
||||||
|
font = JB.Config.font,
|
||||||
|
size = 28,
|
||||||
|
blursize = 2
|
||||||
|
})
|
||||||
|
local tabX = {-256,-256,-256,-256};
|
||||||
|
local matTile = Material("materials/jailbreak_excl/weapon_selection_tile.png");
|
||||||
|
local mul;
|
||||||
|
hook.Add("Think","JB.Think.WeaponSelection.Animate",function()
|
||||||
|
if selectedTab > 0 and LocalPlayer():Alive() and LocalPlayer():Team() < 3 then
|
||||||
|
mul=FrameTime()*40;
|
||||||
|
tabX[1] = math.Clamp(Lerp(0.20 * mul,tabX[1],1),-256,0);
|
||||||
|
tabX[2] = math.Clamp(Lerp(0.18 * mul,tabX[2],1),-256,0);
|
||||||
|
tabX[3] = math.Clamp(Lerp(0.16 * mul,tabX[3],1),-256,0);
|
||||||
|
tabX[4] = math.Clamp(Lerp(0.14 * mul,tabX[4],1),-256,0);
|
||||||
|
else
|
||||||
|
mul=FrameTime()*40;
|
||||||
|
tabX[1] = math.Clamp(Lerp(0.40 * mul,tabX[1],-256),-256,0);
|
||||||
|
tabX[2] = math.Clamp(Lerp(0.39 * mul,tabX[2],-256),-256,0);
|
||||||
|
tabX[3] = math.Clamp(Lerp(0.38 * mul,tabX[3],-256),-256,0);
|
||||||
|
tabX[4] = math.Clamp(Lerp(0.37 * mul,tabX[4],-256),-256,0);
|
||||||
|
end
|
||||||
|
end);
|
||||||
|
hook.Add("HUDPaint","JB.HUDPaint.WeaponSelection",function()
|
||||||
|
if tabX[1] >= -256 and LocalPlayer():Alive() and LocalPlayer():Team() < 3 then
|
||||||
|
for i=1,4 do
|
||||||
|
local y = 250 + ((i-1) * 54);
|
||||||
|
local x = math.Round(tabX[i]);
|
||||||
|
|
||||||
|
surface.SetDrawColor(selectedTab == i and JB.Color.white or JB.Color["#888"]);
|
||||||
|
surface.SetMaterial(matTile);
|
||||||
|
surface.DrawTexturedRect(x + 0,y,256,64);
|
||||||
|
|
||||||
|
if slots[i] and slots[i][1] then
|
||||||
|
draw.SimpleText(slots[i][1].PrintName or "Invalid","JBWeaponSelectionFontBlur",x + 210,y+(64-40)/2+40/2, JB.Color.black,2,1)
|
||||||
|
draw.SimpleText(slots[i][1].PrintName or "Invalid","JBWeaponSelectionFont",x + 210,y+(64-40)/2+40/2, selectedTab == i and JB.Color.white or JB.Color["#888"],2,1)
|
||||||
|
end
|
||||||
|
|
||||||
|
draw.SimpleText(i == 1 and "UNARMED" or i == 2 and "PRIMARY" or i == 3 and "SECONDARY" or i == 4 and "OTHER","JBNormal",x + 4,y+(64-40)/2+3,Color(255,255,255,2));
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
timer.Create("UpdateSWEPSelectthings",1,0,function()
|
||||||
|
if selectedTab > 0 then
|
||||||
|
ArrangeSlots();
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
local nScroll = 1;
|
||||||
|
function JB.Gamemode:PlayerBindPress(p, bind, pressed)
|
||||||
|
|
||||||
|
if not pressed then return false end
|
||||||
|
|
||||||
|
if string.find(bind, "invnext") then
|
||||||
|
if LocalPlayer():Team() > 2 or !LocalPlayer():Alive() then return true end
|
||||||
|
nScroll = nScroll + 1;
|
||||||
|
if nScroll > 4 then
|
||||||
|
nScroll = 1;
|
||||||
|
end
|
||||||
|
|
||||||
|
if selectedTab ~= nScroll then
|
||||||
|
surface.PlaySound("common/wpn_moveselect.wav");
|
||||||
|
end
|
||||||
|
selectedTab = nScroll;
|
||||||
|
ArrangeSlots();
|
||||||
|
return true;
|
||||||
|
elseif string.find(bind, "invprev") then
|
||||||
|
if LocalPlayer():Team() > 2 or !LocalPlayer():Alive() then return true end
|
||||||
|
|
||||||
|
nScroll = nScroll-1;
|
||||||
|
if nScroll < 1 then
|
||||||
|
nScroll = 4;
|
||||||
|
end
|
||||||
|
|
||||||
|
if selectedTab ~= nScroll then
|
||||||
|
surface.PlaySound("common/wpn_moveselect.wav");
|
||||||
|
end
|
||||||
|
selectedTab = nScroll;
|
||||||
|
ArrangeSlots();
|
||||||
|
return true;
|
||||||
|
elseif string.find(bind, "slot0") then
|
||||||
|
selectedTab = 0;
|
||||||
|
return true
|
||||||
|
elseif string.find(bind, "slot1") then
|
||||||
|
if LocalPlayer():Team() > 2 or !LocalPlayer():Alive() then return true end
|
||||||
|
if selectedTab ~= 1 then
|
||||||
|
surface.PlaySound("common/wpn_moveselect.wav");
|
||||||
|
else
|
||||||
|
selectedTab = 0;
|
||||||
|
return true;
|
||||||
|
end
|
||||||
|
selectedTab = 1;
|
||||||
|
ArrangeSlots();
|
||||||
|
return true
|
||||||
|
elseif string.find(bind, "slot2") then
|
||||||
|
if LocalPlayer():Team() > 2 or !LocalPlayer():Alive() then return true end
|
||||||
|
if selectedTab ~= 2 then
|
||||||
|
surface.PlaySound("common/wpn_moveselect.wav");
|
||||||
|
else
|
||||||
|
selectedTab = 0;
|
||||||
|
return true;
|
||||||
|
end
|
||||||
|
selectedTab = 2;
|
||||||
|
ArrangeSlots();
|
||||||
|
return true
|
||||||
|
elseif string.find(bind, "slot3") then
|
||||||
|
if LocalPlayer():Team() > 2 or !LocalPlayer():Alive() then return true end
|
||||||
|
if selectedTab ~= 3 then
|
||||||
|
surface.PlaySound("common/wpn_moveselect.wav");
|
||||||
|
else
|
||||||
|
selectedTab = 0;
|
||||||
|
return true;
|
||||||
|
end
|
||||||
|
selectedTab = 3;
|
||||||
|
ArrangeSlots();
|
||||||
|
return true
|
||||||
|
elseif string.find(bind, "slot4") then
|
||||||
|
if LocalPlayer():Team() > 2 or !LocalPlayer():Alive() then return true end
|
||||||
|
if selectedTab ~= 4 then
|
||||||
|
surface.PlaySound("common/wpn_moveselect.wav");
|
||||||
|
else
|
||||||
|
selectedTab = 0;
|
||||||
|
return true;
|
||||||
|
end
|
||||||
|
selectedTab = 4;
|
||||||
|
ArrangeSlots();
|
||||||
|
return true
|
||||||
|
elseif string.find(bind, "slot5") then
|
||||||
|
selectedTab = 0;
|
||||||
|
return true
|
||||||
|
elseif string.find(bind, "slot6") then
|
||||||
|
selectedTab = 0;
|
||||||
|
return true
|
||||||
|
elseif string.find(bind, "slot7") then
|
||||||
|
selectedTab = 0;
|
||||||
|
return true
|
||||||
|
elseif string.find(bind, "slot8") then
|
||||||
|
selectedTab = 0;
|
||||||
|
return true
|
||||||
|
elseif string.find(bind, "slot9") then
|
||||||
|
selectedTab = 0;
|
||||||
|
return true
|
||||||
|
elseif string.find(bind, "+attack") then
|
||||||
|
if LocalPlayer():Team() > 2 then return true end
|
||||||
|
if selectedTab > 0 and slots[selectedTab] then
|
||||||
|
if not slots[selectedTab][slotPos] or not IsValid(slots[selectedTab][slotPos]) then return true end
|
||||||
|
RunConsoleCommand("use",slots[selectedTab][slotPos]:GetClass())
|
||||||
|
|
||||||
|
nScroll = selectedTab;
|
||||||
|
selectedTab = 0;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
68
gamemode/core/cl_logs.lua
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
net.Receive("JB.GetLogs",function()
|
||||||
|
local DamageLog = net.ReadTable();
|
||||||
|
local printLog=tobool(net.ReadBit());
|
||||||
|
|
||||||
|
if printLog then
|
||||||
|
MsgC(JB.Color.white,[[
|
||||||
|
##############################
|
||||||
|
# #
|
||||||
|
# JAILBREAK 7 LOGS #
|
||||||
|
# EVENTS SINCE ROUND START #
|
||||||
|
# #
|
||||||
|
##############################
|
||||||
|
|
||||||
|
Log generated by player ]]..LocalPlayer():Nick().." ("..LocalPlayer():SteamID()..[[)
|
||||||
|
Log generated at date ]]..os.date()..[[
|
||||||
|
|
||||||
|
]]);
|
||||||
|
MsgC(JB.Color.white,"\n")
|
||||||
|
for k,v in pairs(DamageLog) do
|
||||||
|
MsgC(JB.Color.white,"["..v.time.."] ");
|
||||||
|
|
||||||
|
local clr=JB.Color.white;
|
||||||
|
for k,v in pairs(v.message)do
|
||||||
|
if type(v)=="table" and v.r and v.g and v.b then
|
||||||
|
clr=v;
|
||||||
|
elseif type(v)=="string" then
|
||||||
|
MsgC(clr,v);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
MsgC(clr,"\n");
|
||||||
|
end
|
||||||
|
MsgC(JB.Color.white,"\n##############################\n");
|
||||||
|
end
|
||||||
|
|
||||||
|
JB.ThisRound.Logs = DamageLog;
|
||||||
|
end)
|
||||||
277
gamemode/core/cl_menu_help_options.lua
Normal file
@@ -0,0 +1,277 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
local color_text = Color(223,223,223,230);
|
||||||
|
local matGradient = Material("materials/jailbreak_excl/gradient.png");
|
||||||
|
local frame;
|
||||||
|
|
||||||
|
local slide_cur = 1;
|
||||||
|
local guide_slides={
|
||||||
|
Material("jailbreak_excl/guide/slide_1.png"),
|
||||||
|
Material("jailbreak_excl/guide/slide_2.png"),
|
||||||
|
Material("jailbreak_excl/guide/slide_3.png"),
|
||||||
|
Material("jailbreak_excl/guide/slide_4.png"),
|
||||||
|
}
|
||||||
|
|
||||||
|
function JB.MENU_HELP_OPTIONS()
|
||||||
|
if IsValid(frame) then frame:Remove() end
|
||||||
|
|
||||||
|
frame = vgui.Create("JB.Frame");
|
||||||
|
frame:SetTitle("INFORMATION & OPTIONS");
|
||||||
|
|
||||||
|
frame:SetWide(740);
|
||||||
|
|
||||||
|
local right = frame:Add("JB.Panel");
|
||||||
|
local left = frame:Add("JB.Panel");
|
||||||
|
|
||||||
|
left:SetWide(math.Round(frame:GetWide() * .25) - 15);
|
||||||
|
right:SetWide(math.Round(frame:GetWide() * .75) - 15);
|
||||||
|
|
||||||
|
local tall = right:GetWide() * .65;
|
||||||
|
|
||||||
|
left:SetTall(tall); right:SetTall(tall);
|
||||||
|
|
||||||
|
|
||||||
|
left:SetPos(10,40);
|
||||||
|
right:SetPos(left:GetWide() + left.x + 10,40);
|
||||||
|
|
||||||
|
left.Paint = function() end;
|
||||||
|
|
||||||
|
frame:SetTall(math.Round(right:GetTall() + 50))
|
||||||
|
|
||||||
|
local btn_guide = left:Add("JB.Button");
|
||||||
|
btn_guide:SetSize(left:GetWide(),32);
|
||||||
|
btn_guide:SetText("Guide")
|
||||||
|
|
||||||
|
local btn_options = left:Add("JB.Button");
|
||||||
|
btn_options:SetSize(left:GetWide(),32);
|
||||||
|
btn_options:SetText("Options")
|
||||||
|
btn_options.y = 40;
|
||||||
|
|
||||||
|
local btn_logs = left:Add("JB.Button");
|
||||||
|
btn_logs:SetSize(left:GetWide(),32);
|
||||||
|
btn_logs:SetText("Logs")
|
||||||
|
btn_logs.y = 80;
|
||||||
|
|
||||||
|
local btn_credits = left:Add("JB.Button");
|
||||||
|
btn_credits:SetSize(left:GetWide(),32);
|
||||||
|
btn_credits:SetText("About")
|
||||||
|
btn_credits.y = 120;
|
||||||
|
|
||||||
|
|
||||||
|
btn_guide.OnMouseReleased = function()
|
||||||
|
JB.Util.iterate(right:GetChildren()):Remove();
|
||||||
|
|
||||||
|
slide_cur = 1;
|
||||||
|
|
||||||
|
local controls=right:Add("Panel");
|
||||||
|
controls:SetSize(80*2 + 40,32+80);
|
||||||
|
controls:SetPos(right:GetWide()/2-controls:GetWide()/2,right:GetTall()-controls:GetTall())
|
||||||
|
|
||||||
|
local go_left=controls:Add("JB.Button");
|
||||||
|
go_left:SetSize(80,32);
|
||||||
|
go_left:SetText("Previous");
|
||||||
|
go_left:Dock(LEFT);
|
||||||
|
local go_right=controls:Add("JB.Button");
|
||||||
|
go_right:SetSize(80,32);
|
||||||
|
go_right:SetText("Next");
|
||||||
|
go_right:Dock(RIGHT);
|
||||||
|
|
||||||
|
local slideshow=right:Add("DImage");
|
||||||
|
slideshow:SetSize(512,128);
|
||||||
|
slideshow:SetMaterial(guide_slides[1]);
|
||||||
|
slideshow:SetPos((right:GetWide())/2 - slideshow:GetWide()/2,70)
|
||||||
|
|
||||||
|
go_left.OnMouseReleased=function()
|
||||||
|
slide_cur =slide_cur-1;
|
||||||
|
if slide_cur <= 1 then
|
||||||
|
go_left:SetVisible(false);
|
||||||
|
else
|
||||||
|
go_left:SetVisible(true);
|
||||||
|
end
|
||||||
|
go_right:SetVisible(true);
|
||||||
|
slideshow:SetMaterial(guide_slides[slide_cur]);
|
||||||
|
end
|
||||||
|
go_right.OnMouseReleased=function()
|
||||||
|
slide_cur =slide_cur+1;
|
||||||
|
if slide_cur >= #guide_slides-1 then
|
||||||
|
go_right:SetVisible(false);
|
||||||
|
else
|
||||||
|
go_right:SetVisible(true);
|
||||||
|
end
|
||||||
|
go_left:SetVisible(true);
|
||||||
|
slideshow:SetMaterial(guide_slides[slide_cur]);
|
||||||
|
end
|
||||||
|
go_left:SetVisible(false);
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
btn_logs.OnMouseReleased = function()
|
||||||
|
JB.Util.iterate(right:GetChildren()):Remove();
|
||||||
|
|
||||||
|
local lbl=Label("Round logs",right);
|
||||||
|
lbl:SetPos(20,20);
|
||||||
|
lbl:SetFont("JBLarge");
|
||||||
|
lbl:SizeToContents();
|
||||||
|
lbl:SetColor(JB.Color.white);
|
||||||
|
|
||||||
|
local scrollPanel = vgui.Create( "DScrollPanel", right )
|
||||||
|
scrollPanel:SetSize( right:GetWide()-40, right:GetTall()-20-lbl.y-lbl:GetTall()-20 )
|
||||||
|
scrollPanel:SetPos( 20, lbl.y + lbl:GetTall() + 20 )
|
||||||
|
|
||||||
|
LocalPlayer():ConCommand("jb_logs_get");
|
||||||
|
|
||||||
|
local logs_old = JB.ThisRound.Logs;
|
||||||
|
hook.Add("Think","JB.Think._MENU_.CheckChangesToLogs",function()
|
||||||
|
if not IsValid(scrollPanel) then
|
||||||
|
hook.Remove("Think","JB.Think._MENU_.CheckChangesToLogs");
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
|
||||||
|
if logs_old ~= JB.ThisRound.Logs then
|
||||||
|
hook.Remove("Think","JB.Think._MENU_.CheckChangesToLogs");
|
||||||
|
|
||||||
|
local Panels = {};
|
||||||
|
local pnl;
|
||||||
|
for k,v in ipairs(JB.ThisRound.Logs)do
|
||||||
|
if not pnl or not pnl.subject or pnl.subject ~= v.subject then
|
||||||
|
pnl=vgui.Create("EditablePanel");
|
||||||
|
table.insert(Panels,pnl);
|
||||||
|
pnl.Paint = function(self,w,h)
|
||||||
|
draw.RoundedBox(6,0,0,w,h-10,JB.Color["#111"]);
|
||||||
|
draw.RoundedBox(4,1,1,w-2,h-10-2,JB.Color["#333"]);
|
||||||
|
draw.RoundedBox(0,70- (60/2),1,60,h-2-10,JB.Color["#444"])
|
||||||
|
end
|
||||||
|
pnl:SetWide(scrollPanel:GetWide());
|
||||||
|
pnl.subject = v.subject;
|
||||||
|
end
|
||||||
|
|
||||||
|
local textPanel=vgui.Create("Panel",pnl);
|
||||||
|
textPanel:SetWide(pnl:GetWide());
|
||||||
|
textPanel.Paint = function(self,w,h)
|
||||||
|
JB.Util.drawSimpleShadowText(v.time,"JBExtraSmall",10,h/2,JB.Color.white,0,1,1);
|
||||||
|
|
||||||
|
JB.Util.drawSimpleShadowText(v.kind,"JBExtraSmall",70,h/2,JB.Color.white,1,1,1);
|
||||||
|
|
||||||
|
local clr=JB.Color.white
|
||||||
|
local x=70+(60/2)+10;
|
||||||
|
for _,msg in pairs(v.message)do
|
||||||
|
if type(msg)=="table" and msg.r and msg.g and msg.b then
|
||||||
|
clr = msg;
|
||||||
|
elseif type(msg)=="string" then
|
||||||
|
msg=string.gsub(msg," ?%(STEAM_0:.-%)","");
|
||||||
|
x=x+JB.Util.drawSimpleShadowText(msg,"JBExtraSmall",x,h/2,clr,0,1,1);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
textPanel:SetTall(20);
|
||||||
|
|
||||||
|
textPanel:Dock(TOP);
|
||||||
|
textPanel:DockMargin(0,2,0,2);
|
||||||
|
end
|
||||||
|
|
||||||
|
for k,v in ipairs(Panels)do
|
||||||
|
v:SetTall(#v:GetChildren() * 24 + 10);
|
||||||
|
|
||||||
|
scrollPanel:AddItem(v);
|
||||||
|
v:Dock(TOP);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
btn_options.OnMouseReleased = function()
|
||||||
|
JB.Util.iterate(right:GetChildren()):Remove();
|
||||||
|
|
||||||
|
local lbl=Label("Options",right);
|
||||||
|
lbl:SetPos(20,20);
|
||||||
|
lbl:SetFont("JBLarge");
|
||||||
|
lbl:SizeToContents();
|
||||||
|
lbl:SetColor(JB.Color.white);
|
||||||
|
|
||||||
|
local container=right:Add("Panel");
|
||||||
|
container:SetSize(right:GetWide()-40,right:GetTall()-lbl:GetTall()-lbl.y-40);
|
||||||
|
container:SetPos(20,lbl.y+lbl:GetTall()+20);
|
||||||
|
for k,v in ipairs{
|
||||||
|
{"jb_cl_option_toggleaim","toggle","Toggle aim (default: Right Mouse)"},
|
||||||
|
{"jb_cl_option_togglecrouch","toggle","Toggle crouch (default: CTRL)"},
|
||||||
|
{"jb_cl_option_togglewalk","toggle","Toggle walk (default: ALT)"},
|
||||||
|
{"jb_cl_option_always_spectate","toggle","Always spawn as spectator after joining"}
|
||||||
|
} do
|
||||||
|
local fragment=container:Add("Panel");
|
||||||
|
fragment:SetSize(container:GetWide(),32);
|
||||||
|
fragment:SetPos(0,(k-1)*32);
|
||||||
|
|
||||||
|
local lbl=Label(v[3],fragment);
|
||||||
|
lbl:SetFont("JBSmall");
|
||||||
|
lbl:SizeToContents();
|
||||||
|
lbl:SetPos(32,fragment:GetTall()/2-lbl:GetTall()/2);
|
||||||
|
lbl:SetColor(color_text);
|
||||||
|
|
||||||
|
local DermaCheckbox = vgui.Create( "DCheckBox",fragment )
|
||||||
|
DermaCheckbox:SetPos( fragment:GetTall()/2 - DermaCheckbox:GetWide()/2, fragment:GetTall()/2 - DermaCheckbox:GetTall()/2)// Set the position
|
||||||
|
DermaCheckbox:SetConVar( v[1] )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
btn_credits.OnMouseReleased = function()
|
||||||
|
local text = [[This is the seventh version of the first Garry's Mod edition of Jail Break.
|
||||||
|
It is a complete rewrite and shares no code with previous versions, or any unofficial remake of the gamemode.
|
||||||
|
|
||||||
|
Jail Break was created by Casual Bananas, a software development company based in The Netherlands. We do much more than just Garry's Mod gamemodes and addons; check out our website at casualbananas.com to find out more about our company and what services we offer.
|
||||||
|
|
||||||
|
|
||||||
|
CREDITS
|
||||||
|
: Excl (STEAM_0:0:19441588) - Lead developer in charge of Jail Break since version 1
|
||||||
|
|
||||||
|
SPECIAL THANKS
|
||||||
|
: Camamoow - Inciting me to make this new version of Jail Break.
|
||||||
|
: VTG Community - Bug testing, suggestions and being the first Jail Break 7 server.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Copyright © Casual Bananas 2014 ]];
|
||||||
|
|
||||||
|
JB.Util.iterate(right:GetChildren()):Remove();
|
||||||
|
JB.Util.iterate{Label("About",right)}:SetPos(20,20):SetFont("JBLarge"):SizeToContents():SetColor(JB.Color.white);
|
||||||
|
JB.Util.iterate{Label(text,right)}:SetPos(20,60):SetColor(color_text):SetFont("JBSmall"):SetSize(right:GetWide() - 40,280):SetWrap(true);
|
||||||
|
end
|
||||||
|
|
||||||
|
/* create the menu */
|
||||||
|
frame:Center();
|
||||||
|
frame:MakePopup();
|
||||||
|
|
||||||
|
/* open a tab */
|
||||||
|
|
||||||
|
btn_guide.OnMouseReleased();
|
||||||
|
end
|
||||||
182
gamemode/core/cl_menu_lastrequest.lua
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
local color_text = Color(223,223,223,230);
|
||||||
|
local matGradient = Material("materials/jailbreak_excl/gradient.png");
|
||||||
|
local frame;
|
||||||
|
function JB.MENU_LR()
|
||||||
|
if IsValid(frame) then frame:Remove() end
|
||||||
|
|
||||||
|
frame = vgui.Create("JB.Frame");
|
||||||
|
frame:SetTitle("Last Request");
|
||||||
|
|
||||||
|
if (JB.State ~= STATE_PLAYING and JB.State ~= STATE_SETUP and JB.State ~= STATE_LASTREQUEST) or JB.AlivePrisoners() > 1 or JB:AliveGuards() < 1 or not LocalPlayer():Alive() then
|
||||||
|
|
||||||
|
local lbl = Label("A last request is a last chance for the prisoner team to win the round if all rebelling attempts failed.\nIt will consist of a small game the prisoner doing the request can play against a guard of his choice.\n\nYou can only start a Last Request if you're the last prisoner alive and the round is in progress.",frame);
|
||||||
|
lbl:SetFont("JBSmall");
|
||||||
|
lbl:SetColor(color_text);
|
||||||
|
lbl:SizeToContents();
|
||||||
|
lbl:SetPos(15,30+15);
|
||||||
|
frame:SetSize(lbl:GetWide() + 30,30+15+lbl:GetTall()+15);
|
||||||
|
else
|
||||||
|
frame:SetWide(620);
|
||||||
|
local left = frame:Add("JB.Panel");
|
||||||
|
left:SetSize(math.Round(frame:GetWide() * .35) - 15,412);
|
||||||
|
left:SetPos(10,40);
|
||||||
|
|
||||||
|
local right = frame:Add("JB.Panel");
|
||||||
|
right:SetSize(math.Round(frame:GetWide() * .65) - 15,412);
|
||||||
|
right:SetPos(left:GetWide() + left.x + 10,40);
|
||||||
|
|
||||||
|
frame:SetTall(math.Round(right:GetTall() + 50))
|
||||||
|
|
||||||
|
|
||||||
|
-- populate right panel
|
||||||
|
local lr_selected;
|
||||||
|
local lbl_LRName = Label("",right);
|
||||||
|
lbl_LRName:SetPos(20,20);
|
||||||
|
lbl_LRName:SetFont("JBLarge");
|
||||||
|
lbl_LRName:SizeToContents();
|
||||||
|
lbl_LRName:SetColor(color_text);
|
||||||
|
|
||||||
|
local lbl_LRDetails = Label("",right);
|
||||||
|
lbl_LRDetails:SetPos(20,lbl_LRName.y + lbl_LRName:GetTall() + 16);
|
||||||
|
lbl_LRDetails:SetColor(color_text);
|
||||||
|
lbl_LRDetails:SetFont("JBSmall");
|
||||||
|
lbl_LRDetails:SetSize(right:GetWide() - 40,right:GetTall() - lbl_LRDetails.y - 30-30-32);
|
||||||
|
lbl_LRDetails:SetWrap(true);
|
||||||
|
lbl_LRDetails:SizeToContents();
|
||||||
|
|
||||||
|
local btn_accept = right:Add("JB.Button");
|
||||||
|
btn_accept:SetSize(right:GetWide() - 60,32);
|
||||||
|
btn_accept:SetPos(30,right:GetTall() - 30 - btn_accept:GetTall());
|
||||||
|
btn_accept:SetText("Start Last Request");
|
||||||
|
btn_accept.OnMouseReleased = (function()
|
||||||
|
local Menu = DermaMenu()
|
||||||
|
|
||||||
|
for k,v in pairs(team.GetPlayers(TEAM_GUARD))do
|
||||||
|
if not IsValid(v) then continue end
|
||||||
|
|
||||||
|
local btn = Menu:AddOption( v:Nick() or "Unknown guard",function()
|
||||||
|
RunConsoleCommand("jb_lastrequest_start",lr_selected:GetID(),v:EntIndex());
|
||||||
|
if IsValid(frame) then frame:Remove() end
|
||||||
|
end)
|
||||||
|
if v.GetWarden and v:GetWarden() then
|
||||||
|
btn:SetIcon( "icon16/star.png" )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Menu:AddSpacer()
|
||||||
|
Menu:AddOption( "Random guard",function()
|
||||||
|
local tab = {};
|
||||||
|
for k,v in ipairs(team.GetPlayers(TEAM_GUARD))do
|
||||||
|
if v:Alive() then
|
||||||
|
table.insert(tab,v);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
RunConsoleCommand("jb_lastrequest_start",lr_selected:GetID(),(table.Random(tab)):EntIndex());
|
||||||
|
if IsValid(frame) then frame:Remove() end
|
||||||
|
end ):SetIcon( "icon16/lightbulb.png" )
|
||||||
|
Menu:Open();
|
||||||
|
end);
|
||||||
|
btn_accept:SetVisible(false);
|
||||||
|
|
||||||
|
--populate left panel
|
||||||
|
local function selectLR(lr)
|
||||||
|
if not JB.ValidLR(lr) then return end
|
||||||
|
|
||||||
|
|
||||||
|
btn_accept:SetVisible(true);
|
||||||
|
|
||||||
|
lbl_LRName:SetText(lr:GetName());
|
||||||
|
lbl_LRName:SizeToContents();
|
||||||
|
|
||||||
|
lbl_LRDetails:SetPos(20,lbl_LRName.y + lbl_LRName:GetTall() + 16);
|
||||||
|
lbl_LRDetails:SetSize(right:GetWide() - 40,right:GetTall() - lbl_LRDetails.y - 30-30-32);
|
||||||
|
lbl_LRDetails:SetText(lr:GetDescription());
|
||||||
|
lbl_LRDetails:SetWrap(true);
|
||||||
|
|
||||||
|
lr_selected = lr;
|
||||||
|
end
|
||||||
|
|
||||||
|
left:DockMargin(0,0,0,0);
|
||||||
|
|
||||||
|
for k,v in pairs(JB.LastRequestTypes)do
|
||||||
|
local pnl = vgui.Create("JB.Panel",left);
|
||||||
|
pnl:SetTall(26);
|
||||||
|
pnl:Dock(TOP);
|
||||||
|
pnl:DockMargin(6,6,6,0);
|
||||||
|
pnl.a = 80;
|
||||||
|
pnl.Paint = function(self,w,h)
|
||||||
|
draw.RoundedBox(4,0,0,w,h,JB.Color["#777"]);
|
||||||
|
|
||||||
|
self.a = Lerp(0.1,self.a,self.Hover and 140 or 80);
|
||||||
|
|
||||||
|
surface.SetMaterial(matGradient);
|
||||||
|
surface.SetDrawColor(Color(0,0,0,self.a));
|
||||||
|
surface.DrawTexturedRectRotated(w/2,h/2,w,h,180);
|
||||||
|
|
||||||
|
surface.SetDrawColor(JB.Color.white);
|
||||||
|
surface.SetMaterial(v:GetIcon());
|
||||||
|
surface.DrawTexturedRect(5,5,16,16);
|
||||||
|
|
||||||
|
draw.SimpleText(v:GetName(),"JBNormal",28,h/2,JB.Color.white,0,1);
|
||||||
|
end
|
||||||
|
|
||||||
|
local dummy = vgui.Create("Panel",pnl);
|
||||||
|
dummy:SetSize(pnl:GetWide(),pnl:GetTall());
|
||||||
|
dummy:SetPos(0,0);
|
||||||
|
dummy.OnMouseReleased = function()
|
||||||
|
selectLR(v);
|
||||||
|
end
|
||||||
|
dummy.OnCursorEntered = function()
|
||||||
|
pnl.Hover = true;
|
||||||
|
end
|
||||||
|
dummy.OnCursorExited=function()
|
||||||
|
pnl.Hover = false;
|
||||||
|
end
|
||||||
|
|
||||||
|
pnl.PerformLayout = function(self)
|
||||||
|
dummy:SetSize(self:GetWide(),self:GetTall());
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
frame:Center();
|
||||||
|
frame:MakePopup();
|
||||||
|
end
|
||||||
113
gamemode/core/cl_menu_team.lua
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
local color_text = Color(223,223,223,230);
|
||||||
|
|
||||||
|
local frame;
|
||||||
|
function JB.MENU_TEAM()
|
||||||
|
if IsValid(frame) then frame:Remove() end
|
||||||
|
|
||||||
|
if timer.Exists("JB.MENU_TEAM.Update") then
|
||||||
|
timer.Stop("JB.MENU_TEAM.Update");
|
||||||
|
timer.Remove("JB.MENU_TEAM.Update");
|
||||||
|
end
|
||||||
|
|
||||||
|
frame = vgui.Create("JB.Frame");
|
||||||
|
frame:SetTitle("Team selection");
|
||||||
|
|
||||||
|
frame:SetSize(400,50+15+128+15+32+15+32);
|
||||||
|
|
||||||
|
local img = vgui.Create("DImage",frame);
|
||||||
|
img:SetSize(128,128);
|
||||||
|
img:SetPos(frame:GetWide()/4 * 3 - 128/2,30+15);
|
||||||
|
img:SetMaterial("materials/jailbreak_excl/logo_prisoner.png");
|
||||||
|
|
||||||
|
local img = vgui.Create("DImage",frame);
|
||||||
|
img:SetSize(128,128);
|
||||||
|
img:SetPos(frame:GetWide()/4 * 1 - 128/2,30+15);
|
||||||
|
img:SetMaterial("materials/jailbreak_excl/logo_guard.png");
|
||||||
|
|
||||||
|
local butGuard = vgui.Create("JB.Button",frame);
|
||||||
|
butGuard:SetSize(math.Round(frame:GetWide()/2 - 15*1.5),32);
|
||||||
|
butGuard:SetPos(15,frame:GetTall()-15-32-15-32);
|
||||||
|
butGuard:SetText("Guards ( "..#team.GetPlayers(TEAM_GUARD).." / "..JB:GetGuardsAllowed().." )");
|
||||||
|
butGuard.OnMouseReleased = function()
|
||||||
|
if LocalPlayer():Team() == TEAM_GUARD then
|
||||||
|
frame:Remove()
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
|
||||||
|
if JB:GetGuardsAllowed() > #team.GetPlayers(TEAM_GUARD) then
|
||||||
|
RunConsoleCommand("jb_team_select_guard");
|
||||||
|
frame:Remove();
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local butPrisoner = vgui.Create("JB.Button",frame);
|
||||||
|
butPrisoner:SetSize(math.Round(frame:GetWide()/2 - 15*1.5),32);
|
||||||
|
butPrisoner:SetPos(butGuard.x + butGuard:GetWide() + 15,frame:GetTall()-15-32-15-32);
|
||||||
|
butPrisoner:SetText("Prisoners ( "..#team.GetPlayers(TEAM_PRISONER).." )");
|
||||||
|
butPrisoner.OnMouseReleased = function()
|
||||||
|
if LocalPlayer():Team() ~= TEAM_PRISONER then
|
||||||
|
RunConsoleCommand("jb_team_select_prisoner");
|
||||||
|
end
|
||||||
|
frame:Remove();
|
||||||
|
end
|
||||||
|
|
||||||
|
local butSpec = vgui.Create("JB.Button",frame);
|
||||||
|
butSpec:SetSize(frame:GetWide()-15-15,32);
|
||||||
|
butSpec:SetPos(15,butPrisoner.y + butPrisoner:GetTall()+15);
|
||||||
|
butSpec:SetText("Spectate");
|
||||||
|
butSpec.OnMouseReleased = function()
|
||||||
|
if LocalPlayer():Team() ~= TEAM_SPECTATOR then
|
||||||
|
RunConsoleCommand("jb_team_select_spectator");
|
||||||
|
end
|
||||||
|
frame:Remove();
|
||||||
|
end
|
||||||
|
|
||||||
|
timer.Create("JB.MENU_TEAM.Update",.5,0,function()
|
||||||
|
if not IsValid(frame) or not IsValid(butGuard) or not IsValid(butPrisoner) then
|
||||||
|
if timer.Exists("JB.MENU_TEAM.Update") then
|
||||||
|
timer.Stop("JB.MENU_TEAM.Update");
|
||||||
|
timer.Remove("JB.MENU_TEAM.Update");
|
||||||
|
end
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
|
||||||
|
butGuard:SetText("Guards ( "..#team.GetPlayers(TEAM_GUARD).." / "..JB:GetGuardsAllowed().." )");
|
||||||
|
butPrisoner:SetText("Prisoners ( "..#team.GetPlayers(TEAM_PRISONER).." )");
|
||||||
|
end);
|
||||||
|
|
||||||
|
frame:Center();
|
||||||
|
frame:MakePopup();
|
||||||
|
end
|
||||||
161
gamemode/core/cl_menu_warden.lua
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local color_text = Color(230,230,230,200);
|
||||||
|
|
||||||
|
local frame;
|
||||||
|
function JB.MENU_WARDEN()
|
||||||
|
if IsValid(frame) then frame:Remove() end
|
||||||
|
|
||||||
|
if LocalPlayer().GetWarden and LocalPlayer():GetWarden() and tobool(JB.Config.wardenControl) then
|
||||||
|
frame = vgui.Create("JB.Frame");
|
||||||
|
frame:SetTitle("Warden controls");
|
||||||
|
frame:SetWide(320);
|
||||||
|
|
||||||
|
local yBottom = 30;
|
||||||
|
|
||||||
|
local lbl = Label("Game options",frame);
|
||||||
|
lbl:SetFont("JBLarge");
|
||||||
|
lbl:SetColor(JB.Color["#EEE"]);
|
||||||
|
lbl:SizeToContents();
|
||||||
|
lbl:SetPos(15,yBottom + 15);
|
||||||
|
|
||||||
|
yBottom = lbl.y + lbl:GetTall();
|
||||||
|
|
||||||
|
local function addButton(toggle,name,click)
|
||||||
|
if not toggle then
|
||||||
|
local btn = frame:Add("JB.Button");
|
||||||
|
btn:SetPos(15,yBottom+15);
|
||||||
|
btn:SetSize(frame:GetWide() - 30, 32);
|
||||||
|
btn:SetText(name);
|
||||||
|
btn.OnMouseReleased = click;
|
||||||
|
|
||||||
|
yBottom = btn.y + btn:GetTall();
|
||||||
|
else
|
||||||
|
local lbl = Label(name,frame);
|
||||||
|
lbl:SetFont("JBNormal");
|
||||||
|
lbl:SetColor(color_text);
|
||||||
|
lbl:SizeToContents();
|
||||||
|
lbl:SetPos(15+8,yBottom+15+32/2 - lbl:GetTall()/2);
|
||||||
|
|
||||||
|
local btn = frame:Add("JB.Button");
|
||||||
|
btn:SetPos(frame:GetWide()-15-64,yBottom+15);
|
||||||
|
btn:SetSize(64, 32);
|
||||||
|
btn:SetText(tobool(toggle) == true and "ON" or "OFF");
|
||||||
|
btn.OnMouseReleased = function()
|
||||||
|
btn:SetText(btn:GetText() == "OFF" and "ON" or "OFF");
|
||||||
|
click();
|
||||||
|
end
|
||||||
|
|
||||||
|
yBottom = btn.y + btn:GetTall();
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
addButton(tostring(IsValid(JB.TRANSMITTER) and JB.TRANSMITTER:GetJBWarden_PVPDamage()),"Friendlyfire for prisoners",function() RunConsoleCommand("jb_warden_changecontrol","PVP",tostring(not (IsValid(JB.TRANSMITTER) and JB.TRANSMITTER:GetJBWarden_PVPDamage()))) end);
|
||||||
|
addButton(tostring(IsValid(JB.TRANSMITTER) and JB.TRANSMITTER:GetJBWarden_ItemPickup()),"Item pickup",function() RunConsoleCommand("jb_warden_changecontrol","Pickup",tostring(not (IsValid(JB.TRANSMITTER) and JB.TRANSMITTER:GetJBWarden_ItemPickup()))); end);
|
||||||
|
|
||||||
|
yBottom = yBottom+16;
|
||||||
|
local lbl = Label("Object spawning",frame);
|
||||||
|
lbl:SetFont("JBLarge");
|
||||||
|
lbl:SetColor(JB.Color["#EEE"]);
|
||||||
|
lbl:SizeToContents();
|
||||||
|
lbl:SetPos(15,yBottom + 15);
|
||||||
|
|
||||||
|
yBottom = lbl.y + lbl:GetTall();
|
||||||
|
|
||||||
|
addButton(false,"Spawn ammo box",function() RunConsoleCommand("jb_warden_spawn","AmmoBox") end);
|
||||||
|
addButton(false,"Spawn breakable crate",function() RunConsoleCommand("jb_warden_spawn","Crate") end);
|
||||||
|
addButton(false,"Spawn blockade",function() RunConsoleCommand("jb_warden_spawn","Blockade") end);
|
||||||
|
|
||||||
|
|
||||||
|
frame:SetTall(yBottom+15);
|
||||||
|
frame:Center();
|
||||||
|
frame:MakePopup();
|
||||||
|
elseif JB.State == STATE_SETUP and not IsValid(JB:GetWarden()) then
|
||||||
|
frame = vgui.Create("JB.Frame");
|
||||||
|
frame:SetTitle("Claim warden");
|
||||||
|
|
||||||
|
local lbl = Label("Do not claim warden if you don't own a microphone or can't use your microphone.\nDistorted microphone owners and children ('squeekers') are not allowed to claim warden.",frame);
|
||||||
|
lbl:SetFont("JBSmall");
|
||||||
|
lbl:SetColor(color_text);
|
||||||
|
lbl:SizeToContents();
|
||||||
|
lbl:SetPos(15,30+15);
|
||||||
|
|
||||||
|
local btn = frame:Add("JB.Button");
|
||||||
|
btn:SetSize(math.Round(lbl:GetWide()),32);
|
||||||
|
btn:SetText("Claim Warden");
|
||||||
|
|
||||||
|
btn:SetPos(15,lbl.y + lbl:GetTall() + 15);
|
||||||
|
|
||||||
|
btn.OnMouseReleased = function()
|
||||||
|
RunConsoleCommand("jb_claim_warden");
|
||||||
|
frame:Remove();
|
||||||
|
end
|
||||||
|
|
||||||
|
frame:SetSize(lbl:GetWide() + 30,btn.y + btn:GetTall() + 15);
|
||||||
|
|
||||||
|
local setupTime;
|
||||||
|
local timeLeft;
|
||||||
|
frame.Think = function()
|
||||||
|
setupTime = tonumber(JB.Config.setupTime);
|
||||||
|
timeLeft = math.ceil(math.Clamp(setupTime - math.abs(CurTime() - JB.RoundStartTime),0,setupTime) );
|
||||||
|
if timeLeft <= 0 or IsValid(JB:GetWarden()) then
|
||||||
|
frame:Remove();
|
||||||
|
JB.MENU_WARDEN();
|
||||||
|
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
|
||||||
|
frame:SetTitle("Claim Warden ("..timeLeft.." s)");
|
||||||
|
end
|
||||||
|
|
||||||
|
frame:Center();
|
||||||
|
frame:MakePopup();
|
||||||
|
else
|
||||||
|
frame = vgui.Create("JB.Frame");
|
||||||
|
frame:SetTitle("Claim warden");
|
||||||
|
|
||||||
|
local lbl = Label("You can only claim warden if it's the start of the round and there is no warden yet.",frame);
|
||||||
|
lbl:SetFont("JBSmall");
|
||||||
|
lbl:SetColor(color_text);
|
||||||
|
lbl:SizeToContents();
|
||||||
|
lbl:SetPos(15,30+15);
|
||||||
|
frame:SetSize(lbl:GetWide() + 30,30+15+lbl:GetTall()+15);
|
||||||
|
|
||||||
|
frame:Center();
|
||||||
|
frame:MakePopup();
|
||||||
|
end
|
||||||
|
end
|
||||||
151
gamemode/core/cl_notifications.lua
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
local NoticeMaterial = {}
|
||||||
|
NoticeMaterial[ NOTIFY_GENERIC ] = Material( "vgui/notices/generic" )
|
||||||
|
NoticeMaterial[ NOTIFY_ERROR ] = Material( "vgui/notices/error" )
|
||||||
|
NoticeMaterial[ NOTIFY_UNDO ] = Material( "vgui/notices/undo" )
|
||||||
|
NoticeMaterial[ NOTIFY_HINT ] = Material( "vgui/notices/hint" )
|
||||||
|
NoticeMaterial[ NOTIFY_CLEANUP ] = Material( "vgui/notices/cleanup" )
|
||||||
|
|
||||||
|
local Notices = {}
|
||||||
|
local activeNotice = nil;
|
||||||
|
|
||||||
|
local function queueNotification(text,type)
|
||||||
|
table.insert(Notices,{text=text,type=type});
|
||||||
|
JB:DebugPrint("Notification: "..text);
|
||||||
|
end
|
||||||
|
|
||||||
|
local function createNotice(key)
|
||||||
|
local pnl = vgui.Create("JBNoticePanel");
|
||||||
|
pnl.key = key;
|
||||||
|
pnl.text = Notices[key].text;
|
||||||
|
|
||||||
|
local t = Notices[key].type;
|
||||||
|
pnl.icon = NoticeMaterial[ t ];
|
||||||
|
pnl.type = t == NOTIFY_GENERIC and "NOTICE" or t == NOTIFY_ERROR and "ERROR" or t == NOTIFY_UNDO and "OBJECTIVE" or t == NOTIFY_HINT and "HINT" or "NOTICE";
|
||||||
|
|
||||||
|
activeNotice = pnl;
|
||||||
|
end
|
||||||
|
|
||||||
|
hook.Add("Think","JB.Think.UpdateNotifications", function()
|
||||||
|
if IsValid(activeNotice) then
|
||||||
|
activeNotice:Update();
|
||||||
|
|
||||||
|
if activeNotice:IsDone() then
|
||||||
|
table.remove(Notices,activeNotice.key);
|
||||||
|
activeNotice:Remove();
|
||||||
|
|
||||||
|
local key = table.GetFirstKey(Notices);
|
||||||
|
if key then
|
||||||
|
createNotice(key);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif table.GetFirstKey(Notices) then
|
||||||
|
createNotice(table.GetFirstKey(Notices));
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
local state_expand,state_show,state_die = 1,2,3;
|
||||||
|
local bracket = Material("materials/jailbreak_excl/notify_bracket.png");
|
||||||
|
local bracket_wide = 16;
|
||||||
|
local bracket_tall = 64;
|
||||||
|
vgui.Register("JBNoticePanel",{
|
||||||
|
Init = function(self)
|
||||||
|
self.timeStateStart = SysTime();
|
||||||
|
self.text = "Undefined";
|
||||||
|
self.icon = NoticeMaterial[ NOTIFY_GENERIC ];
|
||||||
|
self.type = NOTIFY_GENERIC;
|
||||||
|
self.state = state_expand;
|
||||||
|
self.colorText = Color(255,255,255,0);
|
||||||
|
self.colorBrackets = Color(255,255,255,0);
|
||||||
|
self.distanceBrackets = 0;
|
||||||
|
|
||||||
|
self:SetSize(1,bracket_tall);
|
||||||
|
end,
|
||||||
|
Update = function(self)
|
||||||
|
surface.SetFont("JBLarge");
|
||||||
|
local wide = surface.GetTextSize(self.text);
|
||||||
|
local mul=FrameTime() * 60;
|
||||||
|
if self.state == state_expand then
|
||||||
|
local distance_max = (wide+16);
|
||||||
|
|
||||||
|
self.distanceBrackets = math.Clamp(math.ceil(Lerp(0.05 * mul,self.distanceBrackets,distance_max + 1)), self.distanceBrackets, distance_max);
|
||||||
|
self.colorBrackets.a = math.Clamp(math.ceil(Lerp(0.1 * mul,self.colorBrackets.a,256)), self.colorBrackets.a, 255);
|
||||||
|
self.colorText.a = math.Clamp(math.ceil(Lerp(0.05 * mul,self.colorText.a,256)), self.colorText.a, 255);
|
||||||
|
|
||||||
|
if self.distanceBrackets >= distance_max and self.colorText.a >= 255 and self.colorBrackets.a >= 255 then
|
||||||
|
self.state = state_show;
|
||||||
|
self.timeStateStart = SysTime();
|
||||||
|
end
|
||||||
|
elseif self.state == state_show then
|
||||||
|
if SysTime() > self.timeStateStart + .8 then
|
||||||
|
self.state = state_die;
|
||||||
|
self.timeStateStart = SysTime();
|
||||||
|
end
|
||||||
|
elseif self.state == state_die then
|
||||||
|
if self.colorText.a < 100 then
|
||||||
|
self.distanceBrackets = math.Clamp(math.floor(Lerp(0.15 * mul,self.distanceBrackets,-1)), 0, self.distanceBrackets);
|
||||||
|
self.colorBrackets.a = math.Clamp(math.floor(Lerp(0.15 * mul,self.colorBrackets.a,-1)), 0, self.colorBrackets.a);
|
||||||
|
end
|
||||||
|
self.colorText.a = math.Clamp(math.floor(Lerp(0.2 * mul,self.colorText.a,-1)), 0, self.colorText.a);
|
||||||
|
end
|
||||||
|
|
||||||
|
self:SetWide(self.distanceBrackets + (bracket_wide * 2));
|
||||||
|
self:SetPos(ScrW()/2 - self:GetWide()/2, ScrH()/10 * 3);
|
||||||
|
end,
|
||||||
|
Paint = function(self,w,h)
|
||||||
|
surface.SetDrawColor(self.colorBrackets);
|
||||||
|
surface.SetMaterial(bracket);
|
||||||
|
surface.DrawTexturedRectRotated(w/2 - bracket_wide/2 - self.distanceBrackets/2, h/2, bracket_wide, bracket_tall, 0) -- left bracket
|
||||||
|
surface.DrawTexturedRectRotated(w/2 + bracket_wide/2 + self.distanceBrackets/2, h/2, bracket_wide, bracket_tall, 180) -- right bracket
|
||||||
|
|
||||||
|
draw.SimpleText(self.type,"JBSmall",math.Round(w/2),8,self.colorText,1,0);
|
||||||
|
draw.SimpleText(self.text,"JBLarge",math.Round(w/2),h/2 + 6, self.colorText,1,1);
|
||||||
|
end,
|
||||||
|
IsDone = function(self)
|
||||||
|
return (self.state == state_die and self.distanceBrackets <= 0 );
|
||||||
|
end,
|
||||||
|
},"Panel");
|
||||||
|
|
||||||
|
net.Receive("JB.SendNotification",function()
|
||||||
|
queueNotification(net.ReadString(),NOTIFY_GENERIC);
|
||||||
|
end);
|
||||||
|
|
||||||
|
-- this is what I can "legacy support" :V
|
||||||
|
function notification.AddProgress() end
|
||||||
|
function notification.Kill() end
|
||||||
|
function notification.Die() end
|
||||||
|
notification.AddLegacy = queueNotification;
|
||||||
|
|
||||||
|
|
||||||
149
gamemode/core/cl_notifications_quick.lua
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
local NoticeMaterial = {}
|
||||||
|
NoticeMaterial[ NOTIFY_GENERIC ] = Material( "vgui/notices/generic" )
|
||||||
|
NoticeMaterial[ NOTIFY_ERROR ] = Material( "vgui/notices/error" )
|
||||||
|
NoticeMaterial[ NOTIFY_UNDO ] = Material( "vgui/notices/undo" )
|
||||||
|
NoticeMaterial[ NOTIFY_HINT ] = Material( "vgui/notices/hint" )
|
||||||
|
NoticeMaterial[ NOTIFY_CLEANUP ] = Material( "vgui/notices/cleanup" )
|
||||||
|
|
||||||
|
local Notices = {}
|
||||||
|
|
||||||
|
local function createNotice(text,type)
|
||||||
|
local pnl = vgui.Create("JBQuickNoticePanel");
|
||||||
|
pnl.text = text;
|
||||||
|
pnl.type = type;
|
||||||
|
|
||||||
|
pnl.index = table.insert(Notices,pnl);
|
||||||
|
end
|
||||||
|
|
||||||
|
local matMiddle = Material("jailbreak_excl/notify_quick_middle.png");
|
||||||
|
local matEdge = Material("jailbreak_excl/notify_quick_edge.png");
|
||||||
|
|
||||||
|
|
||||||
|
local speed = 300;
|
||||||
|
local mul;
|
||||||
|
local fontNotify = "JBSmall";
|
||||||
|
local state_expand,state_show,state_die = 1,2,3;
|
||||||
|
vgui.Register("JBQuickNoticePanel",{
|
||||||
|
Init = function(self)
|
||||||
|
self.timeStateStart = SysTime();
|
||||||
|
self.text = "Undefined";
|
||||||
|
self.type = NOTIFY_GENERIC;
|
||||||
|
self.state = state_expand;
|
||||||
|
self.x = ScrW();
|
||||||
|
self.y = ScrH() * .4
|
||||||
|
self.xTrack = self.x;
|
||||||
|
self.yTrack = self.y;
|
||||||
|
end,
|
||||||
|
PerformLayout = function(self)
|
||||||
|
surface.SetFont(fontNotify);
|
||||||
|
local w = surface.GetTextSize(self.text or "Undefined");
|
||||||
|
|
||||||
|
w= math.Clamp(w+26,17,ScrW()/2); -- margin of 8 at each side
|
||||||
|
self:SetSize(w,32);
|
||||||
|
end,
|
||||||
|
Think = function(self)
|
||||||
|
for k,v in pairs(Notices)do
|
||||||
|
if v == self then
|
||||||
|
self.index = k;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- commit suicide if we're done.
|
||||||
|
if self:IsDone() then
|
||||||
|
for k,v in pairs(Notices)do
|
||||||
|
if v==self then
|
||||||
|
table.remove(Notices,k);
|
||||||
|
break;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self:Remove();
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
|
||||||
|
mul=FrameTime()*10
|
||||||
|
|
||||||
|
self.yTrack = Lerp(mul,self.yTrack,(ScrH() * .4) + ((self.index-1) * 32));
|
||||||
|
|
||||||
|
|
||||||
|
if self.state == state_expand then
|
||||||
|
-- increase X position by FrameTime() * speed
|
||||||
|
|
||||||
|
self.xTrack = Lerp(mul,self.xTrack,ScrW()-self:GetWide(),FrameTime() * speed);
|
||||||
|
|
||||||
|
if self.xTrack <= ScrW() - self:GetWide()+1 then
|
||||||
|
self.state = state_show;
|
||||||
|
self.timeStateStart = SysTime();
|
||||||
|
self.xTrack=(ScrW()-self:GetWide());
|
||||||
|
end
|
||||||
|
elseif self.state == state_show then
|
||||||
|
-- keep the notification where it is, only seet Y position in case an old notification dies.
|
||||||
|
|
||||||
|
if SysTime() > self.timeStateStart + 2.6 then
|
||||||
|
self.state = state_die;
|
||||||
|
self.timeStateStart = SysTime();
|
||||||
|
end
|
||||||
|
elseif self.state == state_die then
|
||||||
|
self.xTrack = Lerp(mul,self.xTrack,ScrW()+1);
|
||||||
|
end
|
||||||
|
|
||||||
|
self.x = math.Round(self.xTrack);
|
||||||
|
self.y = math.Round(self.yTrack);
|
||||||
|
end,
|
||||||
|
Paint = function(self,w,h)
|
||||||
|
if not self.text or not self.type or self.text == "" then return end
|
||||||
|
|
||||||
|
surface.SetDrawColor(JB.Color.white);
|
||||||
|
|
||||||
|
surface.SetMaterial(matEdge);
|
||||||
|
surface.DrawTexturedRect(0,0,16,32);
|
||||||
|
surface.SetMaterial(matMiddle);
|
||||||
|
surface.DrawTexturedRect(16,0,w-16,32);
|
||||||
|
|
||||||
|
draw.SimpleText(self.text,fontNotify.."Shadow",18,h/2,JB.Color.black,0,1);
|
||||||
|
draw.SimpleText(self.text,fontNotify,18,h/2,JB.Color["#EEE"],0,1);
|
||||||
|
end,
|
||||||
|
IsDone = function(self)
|
||||||
|
return (self.state == state_die and self.x >= ScrW() );
|
||||||
|
end,
|
||||||
|
},"Panel");
|
||||||
|
|
||||||
|
concommand.Add("testnotify",function()
|
||||||
|
createNotice("nigga wat",NOTIFY_GENERIC)
|
||||||
|
end);
|
||||||
|
|
||||||
|
net.Receive("JB.SendQuickNotification",function()
|
||||||
|
createNotice(net.ReadString(),NOTIFY_GENERIC);
|
||||||
|
end);
|
||||||
187
gamemode/core/cl_player.lua
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
local cvarAlwaysSpectator = CreateClientConVar( "jb_cl_option_always_spectate", "0", true, false )
|
||||||
|
hook.Add("Initialize","JB.AutomateSpectatorSpawn",function()
|
||||||
|
if cvarAlwaysSpectator:GetBool() then
|
||||||
|
RunConsoleCommand("jb_team_select_spectator");
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
function JB.Gamemode:KeyPress( ply, key )
|
||||||
|
if ( not IsFirstTimePredicted() ) then return end
|
||||||
|
if ( not IsValid( ply ) or ply ~= LocalPlayer() ) then return end
|
||||||
|
end
|
||||||
|
|
||||||
|
local fovSmooth;
|
||||||
|
local mulSpeed,angRightSmooth,angUpSmooth = 0,0,0;
|
||||||
|
local count=0;
|
||||||
|
function JB.Gamemode:CalcView( ply, pos, ang, fov, nearZ, farZ )
|
||||||
|
local ragdoll = LocalPlayer():GetRagdollEntity();
|
||||||
|
if IsValid(ragdoll) and LocalPlayer():GetObserverMode() == OBS_MODE_NONE then
|
||||||
|
local eyes = ragdoll:GetAttachment( ragdoll:LookupAttachment( "eyes" ) );
|
||||||
|
|
||||||
|
if not eyes then return end
|
||||||
|
|
||||||
|
local view = {
|
||||||
|
origin = eyes.Pos,
|
||||||
|
angles = eyes.Ang,
|
||||||
|
fov = 90,
|
||||||
|
};
|
||||||
|
|
||||||
|
return view;
|
||||||
|
end
|
||||||
|
|
||||||
|
if not fovSmooth then fovSmooth = fov end
|
||||||
|
|
||||||
|
mulSpeed=Lerp(FrameTime()*5,mulSpeed,math.Clamp((math.Clamp(ply:GetVelocity():Length(),ply:GetWalkSpeed(),ply:GetRunSpeed()) - ply:GetWalkSpeed())/(ply:GetRunSpeed() - ply:GetWalkSpeed()),0,1));
|
||||||
|
|
||||||
|
if ply:KeyDown(IN_SPEED) then
|
||||||
|
count=count+(FrameTime()*8)*mulSpeed;
|
||||||
|
fovSmooth= Lerp(FrameTime()*5,fovSmooth,(fov + mulSpeed * 10 ));
|
||||||
|
angRightSmooth= -math.abs(math.sin(count)*1);
|
||||||
|
angUpSmooth= math.sin(count)*1.5;
|
||||||
|
else
|
||||||
|
fovSmooth= Lerp(FrameTime()*20,fovSmooth,fov);
|
||||||
|
angRightSmooth= Lerp(FrameTime()*10,angRightSmooth,0);
|
||||||
|
angUpSmooth= Lerp(FrameTime()*10,angUpSmooth,0);
|
||||||
|
mulSpeed=0;
|
||||||
|
count=0;
|
||||||
|
end
|
||||||
|
|
||||||
|
ang:RotateAroundAxis(ang:Right(),angRightSmooth * 2);
|
||||||
|
ang:RotateAroundAxis(ang:Up(),angUpSmooth * 2);
|
||||||
|
|
||||||
|
return JB.Gamemode.BaseClass.CalcView(self,ply,pos,ang,fovSmooth, nearZ, farZ);
|
||||||
|
end
|
||||||
|
|
||||||
|
hook.Add( "PreDrawHalos", "JB.PreDrawHalos.AddHalos", function()
|
||||||
|
if JB.LastRequest ~= "0" and JB.LastRequestPlayers then
|
||||||
|
for k,v in pairs(JB.LastRequestPlayers)do
|
||||||
|
if not IsValid(v) or LocalPlayer() == v then continue; end
|
||||||
|
|
||||||
|
halo.Add({v},team.GetColor(v:Team()),1,1,2,true,true);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end )
|
||||||
|
|
||||||
|
local colorRm = 0;
|
||||||
|
local approachOne = 1;
|
||||||
|
local lastHealth = 0;
|
||||||
|
local ft;
|
||||||
|
hook.Add( "RenderScreenspaceEffects", "JB.RenderScreenspaceEffects.ProcessHealthEffects", function()
|
||||||
|
if LocalPlayer():GetObserverMode() == OBS_MODE_NONE then
|
||||||
|
local ft = FrameTime();
|
||||||
|
|
||||||
|
if lastHealth ~= LocalPlayer():Health() then
|
||||||
|
approachOne = 0;
|
||||||
|
end
|
||||||
|
lastHealth = LocalPlayer():Health();
|
||||||
|
|
||||||
|
approachOne = Lerp(ft*5,approachOne,1);
|
||||||
|
|
||||||
|
colorRm = Lerp(ft/4 * 3,colorRm,(math.Clamp(LocalPlayer():Health(),0,40)/40)*0.8);
|
||||||
|
|
||||||
|
local tab = {}
|
||||||
|
tab[ "$pp_colour_addr" ] = 0
|
||||||
|
tab[ "$pp_colour_addg" ] = 0
|
||||||
|
tab[ "$pp_colour_addb" ] = 0
|
||||||
|
tab[ "$pp_colour_brightness" ] = -.05 + approachOne*.05
|
||||||
|
tab[ "$pp_colour_contrast" ] = 1.1 - approachOne*.1
|
||||||
|
tab[ "$pp_colour_colour" ] = 1 - (.8 - colorRm)
|
||||||
|
tab[ "$pp_colour_mulr" ] = 0
|
||||||
|
tab[ "$pp_colour_mulg" ] = 0
|
||||||
|
tab[ "$pp_colour_mulb" ] = 0
|
||||||
|
|
||||||
|
DrawColorModify( tab )
|
||||||
|
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
local cvarCrouchToggle = CreateClientConVar( "jb_cl_option_togglecrouch", "0", true, false )
|
||||||
|
local cvarWalkToggle = CreateClientConVar( "jb_cl_option_togglewalk", "0", true, false )
|
||||||
|
local walking = false;
|
||||||
|
hook.Add("PlayerBindPress", "JB.PlayerBindPress.KeyBinds", function(pl, bind, pressed)
|
||||||
|
if string.find( bind,"+menu_context" ) then
|
||||||
|
// see cl_context_menu.lua
|
||||||
|
elseif string.find( bind,"+menu" ) then
|
||||||
|
if pressed then
|
||||||
|
RunConsoleCommand("jb_dropweapon")
|
||||||
|
end
|
||||||
|
return true;
|
||||||
|
elseif string.find( bind,"+use" ) and pressed then
|
||||||
|
local tr = LocalPlayer():GetEyeTrace();
|
||||||
|
if tr and IsValid(tr.Entity) and tr.Entity:IsWeapon() then
|
||||||
|
RunConsoleCommand("jb_pickup");
|
||||||
|
return true;
|
||||||
|
end
|
||||||
|
elseif string.find( bind,"gm_showhelp" ) then
|
||||||
|
if pressed then
|
||||||
|
JB.MENU_HELP_OPTIONS();
|
||||||
|
end
|
||||||
|
return true;
|
||||||
|
elseif string.find( bind,"gm_showteam" ) then
|
||||||
|
if pressed then
|
||||||
|
JB.MENU_TEAM();
|
||||||
|
end
|
||||||
|
return true;
|
||||||
|
elseif string.find( bind,"gm_showspare2" ) then
|
||||||
|
if pressed then
|
||||||
|
if LocalPlayer():Team() == TEAM_PRISONER then
|
||||||
|
JB.MENU_LR();
|
||||||
|
elseif LocalPlayer():Team() == TEAM_GUARD then
|
||||||
|
JB.MENU_WARDEN()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true;
|
||||||
|
elseif string.find( bind,"warden" ) then
|
||||||
|
return true;
|
||||||
|
elseif cvarCrouchToggle:GetBool() and pressed and string.find( bind,"duck" ) then
|
||||||
|
if pl:Crouching() then
|
||||||
|
pl:ConCommand("-duck");
|
||||||
|
else
|
||||||
|
pl:ConCommand("+duck");
|
||||||
|
end
|
||||||
|
return true;
|
||||||
|
elseif cvarWalkToggle:GetBool() and pressed and string.find( bind,"walk" ) then
|
||||||
|
if walking then
|
||||||
|
pl:ConCommand("-walk");
|
||||||
|
else
|
||||||
|
pl:ConCommand("+walk");
|
||||||
|
end
|
||||||
|
walking=!walking;
|
||||||
|
return true;
|
||||||
|
elseif string.find(bind,"+voicerecord") and pressed and ((pl:Team() == TEAM_PRISONER and (CurTime() - JB.RoundStartTime) < 30) or (not pl:Alive())) then
|
||||||
|
JB:DebugPrint("You can't use voice chat - you're dead or the round isn't 30 seconds in yet.");
|
||||||
|
return true;
|
||||||
|
end
|
||||||
|
end)
|
||||||
44
gamemode/core/cl_player_meta.lua
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
local pmeta = FindMetaTable("Player");
|
||||||
|
|
||||||
|
local uniqueid;
|
||||||
|
local getname = pmeta.Nick;
|
||||||
|
function pmeta:Nick()
|
||||||
|
if tobool(JB.Config.prisonerNameChange) and LocalPlayer():Alive() and self:Alive() and self:Team() == TEAM_PRISONER then
|
||||||
|
uniqueid = self:UniqueID();
|
||||||
|
return (LocalPlayer():IsAdmin() and "["..getname(self).."] " or "Prisoner ")..(string.Right(uniqueid,string.len(uniqueid)/2));
|
||||||
|
end
|
||||||
|
|
||||||
|
return getname(self);
|
||||||
|
end
|
||||||
530
gamemode/core/cl_scoreboard.lua
Normal file
@@ -0,0 +1,530 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
-- Support for admin mods below
|
||||||
|
(FindMetaTable("Player"))._jbGetRank = function(self)
|
||||||
|
if ES then -- This server uses ExcLServer
|
||||||
|
return (self:ESGetRank():GetPower() > 0 and self:ESGetRank():GetPrettyName()) or "";
|
||||||
|
else -- This server uses an unknown admin mod
|
||||||
|
return self:GetUserGroup() or ""
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Scoreboard
|
||||||
|
local scoreboard;
|
||||||
|
local matEdge = Material("materials/jailbreak_excl/scoreboard_edge.png");
|
||||||
|
local matMiddle = Material("materials/jailbreak_excl/scoreboard_middle.png");
|
||||||
|
local matAva = Material("materials/jailbreak_excl/scoreboard_avatar.png");
|
||||||
|
local color_faded = Color(0,0,0,100)
|
||||||
|
vgui.Register("JBScoreboard.PlayerRow",{
|
||||||
|
Init = function( self )
|
||||||
|
|
||||||
|
self.Avatar = vgui.Create( "AvatarImage", self )
|
||||||
|
self.Avatar:SetSize( 32,32 )
|
||||||
|
self.Avatar:SetMouseInputEnabled( false )
|
||||||
|
|
||||||
|
self:Dock( TOP )
|
||||||
|
self:SetHeight(64)
|
||||||
|
self:DockMargin( 8,0,-24,-12 )
|
||||||
|
|
||||||
|
end,
|
||||||
|
PerformLayout = function(self)
|
||||||
|
if not IsValid(self.Player) then return end
|
||||||
|
|
||||||
|
local w,h = self:GetWide(), self:GetTall();
|
||||||
|
self.Avatar:SetPos(h/2 - self.Avatar:GetTall()/2, h/2 - self.Avatar:GetTall()/2);
|
||||||
|
end,
|
||||||
|
Setup = function( self, pl )
|
||||||
|
|
||||||
|
self.Player = pl
|
||||||
|
|
||||||
|
self.Avatar:SetPlayer( pl, 32 )
|
||||||
|
|
||||||
|
self:Think();
|
||||||
|
self:PerformLayout();
|
||||||
|
|
||||||
|
end,
|
||||||
|
OnCursorEntered = function(self)
|
||||||
|
self.hover = true;
|
||||||
|
end,
|
||||||
|
OnCursorExited = function(self)
|
||||||
|
self.hover = false;
|
||||||
|
end,
|
||||||
|
Think = function( self )
|
||||||
|
|
||||||
|
if ( !IsValid( self.Player ) ) then
|
||||||
|
self:MakeInvalid()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( !self.Player:Alive() ) then
|
||||||
|
self:SetZPos( 1000 )
|
||||||
|
else
|
||||||
|
self:SetZPos(0);
|
||||||
|
end
|
||||||
|
|
||||||
|
end,
|
||||||
|
MakeInvalid = function(self)
|
||||||
|
self:SetZPos(2000);
|
||||||
|
self:Remove();
|
||||||
|
end,
|
||||||
|
Paint = function( self, w, h )
|
||||||
|
|
||||||
|
if ( !IsValid( self.Player ) ) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
--rank
|
||||||
|
if self.Player:_jbGetRank() ~= "" then
|
||||||
|
local x = 70;
|
||||||
|
surface.SetFont("JBExtraSmall")
|
||||||
|
local w,h = surface.GetTextSize(self.Player:_jbGetRank())
|
||||||
|
draw.RoundedBoxEx(6,x,2,w+12,h+4,JB.Color.black,true,true,false,false)
|
||||||
|
draw.RoundedBoxEx(4,x+1,3,w+10,h+4,JB.Color["#222"],true,true,false,false)
|
||||||
|
draw.SimpleText(self.Player:_jbGetRank(),"JBExtraSmall",x+6,8,white,0,1)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
surface.SetDrawColor(self.Player:Alive() and JB.Color.white or JB.Color["#AAA"]);
|
||||||
|
|
||||||
|
surface.SetMaterial(matEdge);
|
||||||
|
surface.DrawTexturedRectRotated(w-h/2,h/2,64,64,180);
|
||||||
|
|
||||||
|
surface.SetMaterial(matMiddle);
|
||||||
|
surface.DrawTexturedRectRotated(math.Round(w/2) - 16,h/2,math.Round(w - 64 - 32),64,0);
|
||||||
|
|
||||||
|
end,
|
||||||
|
OnMouseReleased=function(self)
|
||||||
|
if LocalPlayer():IsAdmin() then
|
||||||
|
|
||||||
|
local m = DermaMenu()
|
||||||
|
|
||||||
|
m:AddOption( "Force swap", function() RunConsoleCommand("jb_admin_swap",self.Player:SteamID() or "0"); end )
|
||||||
|
m:AddOption( "Make spectator", function() RunConsoleCommand("jb_admin_swap_spectator",self.Player:SteamID() or "0"); end )
|
||||||
|
m:AddOption( "Revive", function() RunConsoleCommand("jb_admin_revive",self.Player:SteamID() or "0"); end )
|
||||||
|
|
||||||
|
m:Open()
|
||||||
|
|
||||||
|
JB:DebugPrint("Opened admin menu.");
|
||||||
|
else
|
||||||
|
JB:DebugPrint("Failed to open admin menu. Not an admin.");
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
PaintOver = function(self,w,h)
|
||||||
|
if ( !IsValid( self.Player ) ) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local col = team.GetColor(self.Player:Team());
|
||||||
|
if not self.Player:Alive() then
|
||||||
|
col.r = math.Clamp(col.r *.6,0,255);
|
||||||
|
col.g = math.Clamp(col.g *.6,0,255);
|
||||||
|
col.b = math.Clamp(col.b *.6,0,255);
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.Player == LocalPlayer() then
|
||||||
|
local add = math.abs(math.sin(CurTime() * 1) * 50);
|
||||||
|
col.r = math.Clamp(col.r +add,0,255);
|
||||||
|
col.g = math.Clamp(col.g +add,0,255);
|
||||||
|
col.b = math.Clamp(col.b +add,0,255);
|
||||||
|
end
|
||||||
|
|
||||||
|
surface.SetDrawColor(col);
|
||||||
|
surface.SetMaterial(matAva);
|
||||||
|
surface.DrawTexturedRectRotated(h/2,h/2,64,64,0);
|
||||||
|
|
||||||
|
local white = self.Player:Alive() and JB.Color.white or JB.Color["#BBB"]
|
||||||
|
|
||||||
|
--Name
|
||||||
|
local name=(self.hover and (self.Player:Deaths().." rounds" or "")..(ES and ", "..math.floor(tonumber(self.Player:ESGetNetworkedVariable("playtime",0))/60).." hours playtime" or "")) or self.Player:Nick();
|
||||||
|
draw.SimpleText(name,"JBSmallShadow",self.Avatar.x + self.Avatar:GetWide() + 16,h/2 - 1,JB.Color.black,0,1);
|
||||||
|
draw.SimpleText(name,"JBSmall",self.Avatar.x + self.Avatar:GetWide() + 16,h/2 - 1,white,0,1);
|
||||||
|
|
||||||
|
--Ping
|
||||||
|
draw.SimpleText(self.Player:Ping(),"JBSmallShadow",self:GetWide() - 32 - 24,h/2 - 1,JB.Color.black,1,1);
|
||||||
|
draw.SimpleText(self.Player:Ping(),"JBSmall",self:GetWide() - 32 - 24,h/2 - 1,white,1,1);
|
||||||
|
|
||||||
|
--score
|
||||||
|
surface.SetDrawColor(color_faded)
|
||||||
|
surface.DrawRect(self:GetWide()-64-42,16,36,32)
|
||||||
|
local score=self.Player:Frags()..":"..self.Player:Deaths();
|
||||||
|
draw.SimpleText(score,"JBSmallShadow",self:GetWide() - 64-24,h/2 - 1,JB.Color.black,1,1);
|
||||||
|
draw.SimpleText(score,"JBSmall",self:GetWide() - 64-24,h/2 - 1,white,1,1);
|
||||||
|
|
||||||
|
--status
|
||||||
|
if self.Player.GetWarden and self.Player:GetWarden() then
|
||||||
|
draw.SimpleText("Warden","JBLargeBold",self:GetWide()/2 + 26,26,color_faded,1)
|
||||||
|
elseif self.Player.GetRebel and self.Player:GetRebel() then
|
||||||
|
draw.SimpleText("Rebel","JBLargeBold",self:GetWide()/2 + 30,26,color_faded,1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
},"Panel");
|
||||||
|
|
||||||
|
vgui.Register("JBScoreboard.PlayerRow.Spectator",{
|
||||||
|
Init = function( self )
|
||||||
|
|
||||||
|
self.Avatar = vgui.Create( "AvatarImage", self )
|
||||||
|
self.Avatar:SetSize( 32,32 )
|
||||||
|
self.Avatar:SetMouseInputEnabled( false )
|
||||||
|
|
||||||
|
self:SetSize(64,64)
|
||||||
|
end,
|
||||||
|
PerformLayout = function(self)
|
||||||
|
if not IsValid(self.Player) then return end
|
||||||
|
|
||||||
|
local w,h = self:GetWide(), self:GetTall();
|
||||||
|
self.Avatar:SetPos(w/2 - self.Avatar:GetTall()/2, h/2 - self.Avatar:GetTall()/2);
|
||||||
|
|
||||||
|
end,
|
||||||
|
Setup = function( self, pl )
|
||||||
|
self.Player = pl
|
||||||
|
|
||||||
|
self.Avatar:SetPlayer( pl, 32 )
|
||||||
|
|
||||||
|
self:Think();
|
||||||
|
self:PerformLayout();
|
||||||
|
end,
|
||||||
|
|
||||||
|
Think = function( self )
|
||||||
|
if ( !IsValid( self.Player ) ) then
|
||||||
|
self:MakeInvalid()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
MakeInvalid = function(self)
|
||||||
|
self:Remove();
|
||||||
|
end,
|
||||||
|
OnCursorEntered = function(self)
|
||||||
|
if scoreboard.y < 0 then return end
|
||||||
|
|
||||||
|
local xSc,ySc = self:LocalToScreen( self:GetWide()/2,self:GetTall()/2 );
|
||||||
|
self.namePanel = vgui.Create("Panel");
|
||||||
|
self.namePanel:SetSize(900,24+8);
|
||||||
|
self.namePanel:NoClipping(false);
|
||||||
|
self.namePanel.ColorText = Color(255,255,255,0);
|
||||||
|
self.namePanel.PaintOver = function(this,w,h)
|
||||||
|
if not IsValid(self.Player) then return end
|
||||||
|
|
||||||
|
local w2=math.floor(this.wMv or 0);
|
||||||
|
|
||||||
|
|
||||||
|
surface.SetDrawColor(JB.Color.black);
|
||||||
|
draw.NoTexture();
|
||||||
|
surface.DrawPoly{
|
||||||
|
{x=w/2 - 4, y = h-8},
|
||||||
|
{x=w/2 + 4, y = h-8},
|
||||||
|
{x=w/2, y=h}
|
||||||
|
}
|
||||||
|
|
||||||
|
h=h-8;
|
||||||
|
|
||||||
|
|
||||||
|
draw.RoundedBox(2,w/2 -w2/2,0,w2,h,JB.Color.black);
|
||||||
|
draw.RoundedBox(4,w/2 -w2/2 + 2,2,w2-4,h-4,JB.Color["#111"]);
|
||||||
|
|
||||||
|
this.ColorText.a = Lerp(FrameTime()*1,this.ColorText.a,255);
|
||||||
|
|
||||||
|
w = JB.Util.drawSimpleShadowText(self.Player:Nick(),"JBSmall",w/2,h/2,this.ColorText,1,1);
|
||||||
|
this.wMv = Lerp(FrameTime()*18,this.wMv or 8,w + 12);
|
||||||
|
|
||||||
|
end
|
||||||
|
self.namePanel.Think = function(this)
|
||||||
|
if not IsValid(self) or not self:IsVisible() or not IsValid(scoreboard) or not scoreboard.Expand or not scoreboard:IsVisible() or ( IsValid(this) and not IsValid(self.namePanel) ) then this:Remove(); end
|
||||||
|
end
|
||||||
|
self.namePanel:SetPos(xSc - self.namePanel:GetWide()/2,ySc - 44 - self.namePanel:GetTall()/2);
|
||||||
|
end,
|
||||||
|
OnCursorExited = function(self)
|
||||||
|
if IsValid(self.namePanel) then
|
||||||
|
self.namePanel:Remove();
|
||||||
|
end
|
||||||
|
self.namePanel = nil;
|
||||||
|
end,
|
||||||
|
PaintOver = function(self,w,h)
|
||||||
|
if ( !IsValid( self.Player ) ) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local col = team.GetColor(self.Player:Team());
|
||||||
|
|
||||||
|
if self.Player == LocalPlayer() then
|
||||||
|
local add = math.abs(math.sin(CurTime() * 1) * 50);
|
||||||
|
col.r = math.Clamp(col.r +add,0,255);
|
||||||
|
col.g = math.Clamp(col.g +add,0,255);
|
||||||
|
col.b = math.Clamp(col.b +add,0,255);
|
||||||
|
end
|
||||||
|
|
||||||
|
surface.SetDrawColor(col);
|
||||||
|
surface.SetMaterial(matAva);
|
||||||
|
surface.DrawTexturedRectRotated(w/2,h/2,64,64,0);
|
||||||
|
end
|
||||||
|
},"Panel");
|
||||||
|
|
||||||
|
local color_text = Color(255,255,255,0);
|
||||||
|
local color_shadow = Color(0,0,0,0);
|
||||||
|
local color_hidden = Color(0,0,0,0);
|
||||||
|
vgui.Register("JBScoreboard",{
|
||||||
|
Init = function( self )
|
||||||
|
self.Expand = true;
|
||||||
|
|
||||||
|
self.Header = self:Add( "Panel" )
|
||||||
|
self.Header:Dock( TOP )
|
||||||
|
self.Header:SetHeight( 100 )
|
||||||
|
self.Header:DockMargin(0,0,0,20)
|
||||||
|
|
||||||
|
self.Footer = self:Add( "Panel" )
|
||||||
|
self.Footer:Dock( BOTTOM )
|
||||||
|
|
||||||
|
self.Name = self.Header:Add( "DLabel" )
|
||||||
|
self.Name:SetFont( "JBExtraExtraLarge" )
|
||||||
|
self.Name:SetTextColor( color_text )
|
||||||
|
self.Name:Dock( TOP )
|
||||||
|
self.Name:SizeToContents();
|
||||||
|
self.Name:SetContentAlignment( 5 )
|
||||||
|
self.Name:SetText("Jail Break 7");
|
||||||
|
|
||||||
|
self.Spectators = self.Footer:Add( "DLabel" )
|
||||||
|
self.Spectators:SetFont("JBNormal");
|
||||||
|
self.Spectators:SetTextColor( color_text );
|
||||||
|
self.Spectators:Dock(TOP);
|
||||||
|
self.Spectators:SetContentAlignment( 5 )
|
||||||
|
self.Spectators:SetText("Spectators");
|
||||||
|
self.Spectators:SizeToContents();
|
||||||
|
self.Spectators:DockMargin(0,3,0,0);
|
||||||
|
|
||||||
|
|
||||||
|
self.ScoresSpectators = self.Footer:Add("Panel");
|
||||||
|
self.ScoresSpectators:Dock(TOP);
|
||||||
|
self.ScoresSpectators.Think = function(this)
|
||||||
|
if not self:IsVisible() then return end
|
||||||
|
|
||||||
|
local count=#this:GetChildren()
|
||||||
|
local perRow=math.floor(this:GetWide()/64);
|
||||||
|
local rows=math.ceil(count/perRow);
|
||||||
|
|
||||||
|
local row_current = 1;
|
||||||
|
local lastRowCount = count - (perRow*(rows-1));
|
||||||
|
local x = this:GetWide()/2 - (perRow*64)/2;
|
||||||
|
local y = 8;
|
||||||
|
local isFirst= true;
|
||||||
|
for k,v in ipairs(this:GetChildren())do
|
||||||
|
if not IsValid(v) then continue end
|
||||||
|
|
||||||
|
x=x+64;
|
||||||
|
if x > perRow*64 then
|
||||||
|
x=this:GetWide()/2 - (perRow*64)*2;
|
||||||
|
row_current=row_current+1;
|
||||||
|
isFirst = true;
|
||||||
|
y=y+64+4;
|
||||||
|
end
|
||||||
|
|
||||||
|
if row_current == rows and isFirst then
|
||||||
|
x= this:GetWide()/2 - (lastRowCount*64)/2 + 32;
|
||||||
|
end
|
||||||
|
|
||||||
|
v.x = x - 32;
|
||||||
|
v.y = y;
|
||||||
|
|
||||||
|
isFirst = false;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self.Host = self.Header:Add( "DLabel" )
|
||||||
|
self.Host:SetFont("JBNormal");
|
||||||
|
self.Host:SetTextColor( color_text );
|
||||||
|
self.Host:Dock(TOP);
|
||||||
|
self.Host:SetContentAlignment( 5 )
|
||||||
|
self.Host:SetText("A gamemode by Excl, hosted by "..JB.Config.website);
|
||||||
|
self.Host:SizeToContents();
|
||||||
|
|
||||||
|
self.ScoresGuards = self:Add( "DScrollPanel" )
|
||||||
|
self.ScoresGuards:Dock( LEFT )
|
||||||
|
|
||||||
|
self.ScoresPrisoners = self:Add( "DScrollPanel" )
|
||||||
|
self.ScoresPrisoners:Dock( RIGHT )
|
||||||
|
|
||||||
|
|
||||||
|
self:SetSize( 700, ScrH() - 200 )
|
||||||
|
self.y = -self:GetTall();
|
||||||
|
self.x = ScrW()/2 - self:GetWide()/2;
|
||||||
|
|
||||||
|
self.ySmooth = self.y;
|
||||||
|
end,
|
||||||
|
|
||||||
|
PerformLayout = function( self )
|
||||||
|
self.ScoresGuards:SetWide(self:GetWide()/2 - 8);
|
||||||
|
self.ScoresPrisoners:SetWide(self:GetWide()/2 - 8);
|
||||||
|
self.Host:SetWide(self:GetWide());
|
||||||
|
|
||||||
|
self.ScoresGuards:PerformLayout();
|
||||||
|
self.ScoresPrisoners:PerformLayout();
|
||||||
|
|
||||||
|
self.ScoresSpectators:SetSize(self.Footer:GetWide(),math.ceil(#self.ScoresSpectators:GetChildren()/(self.ScoresSpectators:GetWide()/64))*64+8*2);
|
||||||
|
|
||||||
|
self.Header:SetHeight( self.Name:GetTall()+20 )
|
||||||
|
local max = 0;
|
||||||
|
for k,v in pairs(self.Footer:GetChildren())do
|
||||||
|
if v.y + v:GetTall() > max then
|
||||||
|
max = v.y + v:GetTall();
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self.Footer:SetHeight(max);
|
||||||
|
end,
|
||||||
|
|
||||||
|
Paint = function( self, w, h )
|
||||||
|
//DrawToyTown(2,ScrH());
|
||||||
|
end,
|
||||||
|
|
||||||
|
Think = function( self )
|
||||||
|
|
||||||
|
local w,h = self:GetWide(),self:GetTall();
|
||||||
|
|
||||||
|
if not self.Expand then
|
||||||
|
if math.floor(self.y) > -h then
|
||||||
|
color_text.a = Lerp(FrameTime()*12,color_text.a,0);
|
||||||
|
color_shadow.a = color_text.a * .8;
|
||||||
|
|
||||||
|
if math.floor(color_text.a) <= 1 then
|
||||||
|
self.ySmooth = Lerp(FrameTime()*3,self.ySmooth,-h);
|
||||||
|
self.y = math.Round(self.ySmooth);
|
||||||
|
end
|
||||||
|
|
||||||
|
self.Name:SetTextColor( color_text )
|
||||||
|
self.Host:SetTextColor( color_text );
|
||||||
|
self.Name:SetExpensiveShadow( 2, color_shadow )
|
||||||
|
self.Host:SetExpensiveShadow( 1, color_shadow )
|
||||||
|
|
||||||
|
if #self.ScoresSpectators:GetChildren() <= 0 then
|
||||||
|
self.Spectators:SetTextColor( color_hidden );
|
||||||
|
self.Spectators:SetExpensiveShadow( 1, color_hidden )
|
||||||
|
else
|
||||||
|
self.Spectators:SetTextColor( color_text );
|
||||||
|
self.Spectators:SetExpensiveShadow( 1, color_shadow )
|
||||||
|
end
|
||||||
|
elseif self:IsVisible() and not self.Expand and math.floor(self.ySmooth) <= -h + 1 then
|
||||||
|
self:Hide();
|
||||||
|
color_text.a = 0;
|
||||||
|
JB:DebugPrint("Scoreboard hidden");
|
||||||
|
end
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local target = (ScrH()/2 - h/2);
|
||||||
|
|
||||||
|
self.ySmooth = Lerp(FrameTime()*10,self.ySmooth,target);
|
||||||
|
self.y = math.Round(self.ySmooth);
|
||||||
|
|
||||||
|
if math.ceil(self.ySmooth) >= target then
|
||||||
|
color_text.a = Lerp(FrameTime()*2,color_text.a,255);
|
||||||
|
color_shadow.a = color_text.a * .8;
|
||||||
|
|
||||||
|
self.Name:SetTextColor( color_text )
|
||||||
|
self.Host:SetTextColor( color_text );
|
||||||
|
|
||||||
|
if #self.ScoresSpectators:GetChildren() <= 0 then
|
||||||
|
self.Spectators:SetTextColor( color_hidden );
|
||||||
|
self.Spectators:SetExpensiveShadow( 1, color_hidden )
|
||||||
|
else
|
||||||
|
self.Spectators:SetTextColor( color_text );
|
||||||
|
self.Spectators:SetExpensiveShadow( 1, color_shadow )
|
||||||
|
end
|
||||||
|
self.Name:SetExpensiveShadow( 2, color_shadow )
|
||||||
|
self.Host:SetExpensiveShadow( 1, color_shadow )
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
for id, pl in pairs( player.GetAll() ) do
|
||||||
|
if ( IsValid( pl.ScoreEntry ) ) then
|
||||||
|
if (pl:Team() ~= pl.ScoreEntry.Team or (not IsValid(pl.ScoreEntry.scoreboard)) or pl.ScoreEntry.scoreboard ~= self) then
|
||||||
|
JB:DebugPrint("Removed invalid score panel");
|
||||||
|
pl.ScoreEntry:MakeInvalid();
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if pl:Team() == TEAM_GUARD or pl:Team() == TEAM_PRISONER then
|
||||||
|
|
||||||
|
pl.ScoreEntry = vgui.Create("JBScoreboard.PlayerRow" );
|
||||||
|
pl.ScoreEntry:Setup( pl );
|
||||||
|
|
||||||
|
|
||||||
|
if pl:Team() == TEAM_PRISONER then
|
||||||
|
self.ScoresPrisoners:AddItem( pl.ScoreEntry );
|
||||||
|
pl.ScoreEntry.scoreboard = self;
|
||||||
|
pl.ScoreEntry.Team = TEAM_PRISONER;
|
||||||
|
elseif pl:Team() == TEAM_GUARD then
|
||||||
|
self.ScoresGuards:AddItem( pl.ScoreEntry );
|
||||||
|
pl.ScoreEntry.scoreboard = self;
|
||||||
|
pl.ScoreEntry.Team = TEAM_GUARD;
|
||||||
|
end
|
||||||
|
elseif pl:Team() == TEAM_SPECTATOR or pl:Team() == TEAM_UNASSIGNED then
|
||||||
|
pl.ScoreEntry = self.ScoresSpectators:Add("JBScoreboard.PlayerRow.Spectator");
|
||||||
|
pl.ScoreEntry:Setup(pl);
|
||||||
|
pl.ScoreEntry.scoreboard = self;
|
||||||
|
pl.ScoreEntry.Team = pl:Team();
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end,
|
||||||
|
},"Panel");
|
||||||
|
|
||||||
|
timer.Create("JB.Scoreboard.UpdateLayout",1,0,function()
|
||||||
|
if IsValid(scoreboard) then
|
||||||
|
scoreboard:PerformLayout();
|
||||||
|
end
|
||||||
|
end);
|
||||||
|
|
||||||
|
|
||||||
|
JB.Gamemode.ScoreboardShow = function()
|
||||||
|
if ( !IsValid( scoreboard ) ) then
|
||||||
|
scoreboard = vgui.Create("JBScoreboard");
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( IsValid( scoreboard ) ) then
|
||||||
|
scoreboard.Expand = true;
|
||||||
|
scoreboard:Show()
|
||||||
|
//scoreboard:MakePopup()
|
||||||
|
gui.EnableScreenClicker(true);
|
||||||
|
scoreboard:SetKeyboardInputEnabled( false )
|
||||||
|
|
||||||
|
JB:DebugPrint("Scoreboard shown");
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
JB.Gamemode.ScoreboardHide = function()
|
||||||
|
if ( IsValid( scoreboard ) ) then
|
||||||
|
scoreboard.Expand = false;
|
||||||
|
gui.EnableScreenClicker(false);
|
||||||
|
end
|
||||||
|
end
|
||||||
217
gamemode/core/cl_voice.lua
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local PANEL = {}
|
||||||
|
local PlayerVoicePanels = {}
|
||||||
|
local matAva = Material("materials/jailbreak_excl/scoreboard_avatar.png");
|
||||||
|
function PANEL:Init()
|
||||||
|
|
||||||
|
self.LabelName = vgui.Create( "DLabel", self )
|
||||||
|
self.LabelName:SetFont( "JBNormal" )
|
||||||
|
self.LabelName:Dock( FILL )
|
||||||
|
self.LabelName:DockMargin( 14, 0, 0, 0 )
|
||||||
|
self.LabelName:SetTextColor( JB.Color.white )
|
||||||
|
self.LabelName:SetExpensiveShadow( 2, Color( 0, 0, 0, 200 ) )
|
||||||
|
self.Avatar = vgui.Create( "AvatarImage", self )
|
||||||
|
self.Avatar:Dock( LEFT );
|
||||||
|
self.Avatar:SetSize( 32, 32 )
|
||||||
|
|
||||||
|
|
||||||
|
self.Color = JB.Color["#aaa"];
|
||||||
|
|
||||||
|
self:SetSize( 250, 32 + 8 )
|
||||||
|
self:DockPadding( 4, 4, 4, 4 )
|
||||||
|
self:DockMargin( 0, 6, 0, 6 )
|
||||||
|
self:Dock( BOTTOM )
|
||||||
|
|
||||||
|
self.SoundLines = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||||
|
|
||||||
|
self:NoClipping(true);
|
||||||
|
end
|
||||||
|
|
||||||
|
function PANEL:Setup( ply )
|
||||||
|
|
||||||
|
self.ply = ply
|
||||||
|
self.LabelName:SetText( ply:Nick() )
|
||||||
|
self.Avatar:SetPlayer( ply )
|
||||||
|
|
||||||
|
self.Color = team.GetColor( ply:Team() )
|
||||||
|
self.Color.a = 50;
|
||||||
|
|
||||||
|
self:InvalidateLayout()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
local iconWarden=Material("icon16/asterisk_yellow.png");
|
||||||
|
local matGradient=Material("jailbreak_excl/gradient.png");
|
||||||
|
function PANEL:Paint( w, h )
|
||||||
|
if ( !IsValid( self.ply ) ) then return end
|
||||||
|
|
||||||
|
draw.RoundedBox( 0, 20, 4, w - 20, h-8, JB.Color.black )
|
||||||
|
draw.RoundedBox( 0, 21, 5, w-2 - 20, h-10, JB.Color["#111"] )
|
||||||
|
|
||||||
|
self.Color.a = 2
|
||||||
|
surface.SetDrawColor(self.Color);
|
||||||
|
surface.SetMaterial(matGradient);
|
||||||
|
surface.DrawTexturedRectRotated(20 + (w-20)/2,h/2,w-2 - 20, h-10,180);
|
||||||
|
|
||||||
|
for i=1,60 do
|
||||||
|
self.Color.a = (30 - (math.sin(math.pi/2 - (i/30 * math.pi)) * 30));
|
||||||
|
surface.SetDrawColor(self.Color);
|
||||||
|
surface.DrawRect(w-(3*i),h/2-(self.SoundLines[i]*24/2),1,1+self.SoundLines[i]*24);
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.ply.GetWarden and self.ply:GetWarden() then
|
||||||
|
surface.SetDrawColor(JB.Color.white);
|
||||||
|
surface.SetMaterial(iconWarden);
|
||||||
|
surface.DrawTexturedRect(w - 16 - (h-16)/2, (h-16)/2, 16, 16);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function PANEL:PaintOver()
|
||||||
|
if not IsValid(self.ply) or not IsValid(self.Avatar) then return end
|
||||||
|
|
||||||
|
local w,h = self.Avatar:GetSize();
|
||||||
|
|
||||||
|
local col = team.GetColor(self.ply:Team());
|
||||||
|
if not self.ply:Alive() then
|
||||||
|
col.r = math.Clamp(col.r *.6,0,255);
|
||||||
|
col.g = math.Clamp(col.g *.6,0,255);
|
||||||
|
col.b = math.Clamp(col.b *.6,0,255);
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.ply == LocalPlayer() then
|
||||||
|
local add = math.abs(math.sin(CurTime() * 1) * 30);
|
||||||
|
col.r = math.Clamp(col.r +add,0,255);
|
||||||
|
col.g = math.Clamp(col.g +add,0,255);
|
||||||
|
col.b = math.Clamp(col.b +add,0,255);
|
||||||
|
end
|
||||||
|
|
||||||
|
surface.SetDrawColor(col);
|
||||||
|
surface.SetMaterial(matAva);
|
||||||
|
surface.DrawTexturedRectRotated(self.Avatar.x + h/2,self.Avatar.y + h/2,64,64,0);
|
||||||
|
end
|
||||||
|
|
||||||
|
function PANEL:Think( )
|
||||||
|
if ( self.fadeAnim ) then
|
||||||
|
self.fadeAnim:Run()
|
||||||
|
end
|
||||||
|
|
||||||
|
if not IsValid(self.ply) then return end
|
||||||
|
|
||||||
|
if not self.nextLine or self.nextLine <= CurTime() then
|
||||||
|
self.nextLine = CurTime() + 1/60 -- This will make the effect cap at 60 fps.
|
||||||
|
|
||||||
|
local vol = (self.ply == LocalPlayer()) and math.Rand(0,1) or self.ply:VoiceVolume();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
table.insert(self.SoundLines,1,Lerp(0.4,self.SoundLines[1],vol));
|
||||||
|
table.remove(self.SoundLines,61);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function PANEL:FadeOut( anim, delta, data )
|
||||||
|
if ( anim.Finished ) then
|
||||||
|
|
||||||
|
if ( IsValid( PlayerVoicePanels[ self.ply ] ) ) then
|
||||||
|
PlayerVoicePanels[ self.ply ]:Remove()
|
||||||
|
PlayerVoicePanels[ self.ply ] = nil
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
return end
|
||||||
|
|
||||||
|
self:SetAlpha( 255 - (255 * delta) )
|
||||||
|
end
|
||||||
|
|
||||||
|
derma.DefineControl( "VoiceNotify", "", PANEL, "DPanel" )
|
||||||
|
|
||||||
|
function GM:PlayerStartVoice( ply )
|
||||||
|
|
||||||
|
if ( !IsValid( g_VoicePanelList ) ) then return end
|
||||||
|
|
||||||
|
-- There'd be an exta one if voice_loopback is on, so remove it.
|
||||||
|
GAMEMODE:PlayerEndVoice( ply )
|
||||||
|
|
||||||
|
|
||||||
|
if ( IsValid( PlayerVoicePanels[ ply ] ) ) then
|
||||||
|
|
||||||
|
if ( PlayerVoicePanels[ ply ].fadeAnim ) then
|
||||||
|
PlayerVoicePanels[ ply ].fadeAnim:Stop()
|
||||||
|
PlayerVoicePanels[ ply ].fadeAnim = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
PlayerVoicePanels[ ply ]:SetAlpha( 255 )
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( !IsValid( ply ) ) then return end
|
||||||
|
|
||||||
|
local pnl = g_VoicePanelList:Add( "VoiceNotify" )
|
||||||
|
pnl:Setup( ply )
|
||||||
|
|
||||||
|
PlayerVoicePanels[ ply ] = pnl
|
||||||
|
end
|
||||||
|
|
||||||
|
timer.Create( "JB.VoiceClean", 10, 0, function()
|
||||||
|
for k, v in pairs( PlayerVoicePanels ) do
|
||||||
|
if ( !IsValid( k ) ) then
|
||||||
|
GAMEMODE:PlayerEndVoice( k )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end )
|
||||||
|
timer.Remove("VoiceClean");
|
||||||
|
|
||||||
|
function JB.Gamemode:PlayerEndVoice( ply )
|
||||||
|
if ( IsValid( PlayerVoicePanels[ ply ] ) ) then
|
||||||
|
if ( PlayerVoicePanels[ ply ].fadeAnim ) then return end
|
||||||
|
|
||||||
|
PlayerVoicePanels[ ply ].fadeAnim = Derma_Anim( "FadeOut", PlayerVoicePanels[ ply ], PlayerVoicePanels[ ply ].FadeOut )
|
||||||
|
PlayerVoicePanels[ ply ].fadeAnim:Start( .1 )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
hook.Add( "InitPostEntity", "JB.InitPostEntity.CreateVoiceVGUI", function()
|
||||||
|
|
||||||
|
g_VoicePanelList = vgui.Create( "DPanel" )
|
||||||
|
|
||||||
|
g_VoicePanelList:ParentToHUD()
|
||||||
|
g_VoicePanelList:SetPos( ScrW() - 250, 50 )
|
||||||
|
g_VoicePanelList:SetSize( 250, ScrH() - 100 )
|
||||||
|
g_VoicePanelList:SetDrawBackground( false )
|
||||||
|
|
||||||
|
end )
|
||||||
|
hook.Remove("InitPostEntity","CreateVoiceVGUI");
|
||||||
60
gamemode/core/sh_colors.lua
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
-- ####################################################################################
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## __________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||||
|
-- ## All Rights Reserved. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## NOTICE: All information contained herein is, and remains ##
|
||||||
|
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||||
|
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||||
|
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||||
|
-- ## protected by trade secret or copyright law. ##
|
||||||
|
-- ## Dissemination of this information or reproduction of this material ##
|
||||||
|
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||||
|
-- ## from Casual Bananas ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## _________________________ ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||||
|
-- ## chamber of commerce) in The Netherlands. ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## Company (KVK) number : 59449837 ##
|
||||||
|
-- ## Email : info@casualbananas.com ##
|
||||||
|
-- ## ##
|
||||||
|
-- ## ##
|
||||||
|
-- ####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
JB.Color = {};
|
||||||
|
|
||||||
|
-- just a stupid conveinience function for adding new colors on the fly.
|
||||||
|
setmetatable(JB.Color,{
|
||||||
|
__index = function(tbl,key)
|
||||||
|
if type(key) == "string" and string.Left(key,1) == "#" and (string.len(key) == 4 or string.len(key) == 7) then
|
||||||
|
local hex = key:gsub("#","");
|
||||||
|
if string.len(hex) == 3 then
|
||||||
|
local real = "";
|
||||||
|
for i=1,3 do
|
||||||
|
real=real..hex[i]..hex[i];
|
||||||
|
end
|
||||||
|
hex=real;
|
||||||
|
end
|
||||||
|
|
||||||
|
local rgb=Color(tonumber("0x"..hex:sub(1,2)), tonumber("0x"..hex:sub(3,4)), tonumber("0x"..hex:sub(5,6)));
|
||||||
|
tbl[key] = rgb; -- cache result
|
||||||
|
return rgb;
|
||||||
|
end
|
||||||
|
|
||||||
|
return Color(255,255,0,200);
|
||||||
|
end
|
||||||
|
});
|
||||||
|
|
||||||
|
JB.Color.black = Color(0,0,0);
|
||||||
|
JB.Color.white = Color(255,255,255);
|
||||||