-
Notifications
You must be signed in to change notification settings - Fork 6
/
Client.lua
109 lines (86 loc) · 3.84 KB
/
Client.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
--=============================================================================
--
-- RifleRange/Client.lua
--
-- Created by Max McGuire ([email protected])
-- Copyright (c) 2010, Unknown Worlds Entertainment, Inc.
--
-- This file is the entry point for the client code of the game. It's
-- automatically loaded by the engine when a game starts.
--
--=============================================================================
-- Set the name of the VM for debugging
decoda_name = "Client"
Script.Load("lua/Shared.lua")
--load the keybind system before the ui so they can register there binds
Script.Load("/lua/KeybindMapper.lua")
Script.Load("lua/ui/PlayerUI.lua")
Script.Load("lua/ui/ChatUI.lua")
Script.Load("lua/ui/KillUI.lua")
Client.SetMouseVisible(false)
Client.SetMouseCaptured(true)
Client.SetMouseClipped(false)
function ShowInGameMenu()
Client.SetMouseVisible(true)
Client.SetMouseCaptured(false)
KeybindMapper:InGameMenuOpened()
Shared.SetMenu("ui/main_menu.swf")
end
function OnCommandHelp(userdata, ...)
local args = { ... }
if (args[1] == "commands") then
Shared.Message("this should be a complete list of commands")
Shared.Message("* changeclass")
Shared.Message("* nick")
Shared.Message("* help")
Shared.Message("* stuck")
Shared.Message("* target")
Shared.Message("* lua")
Shared.Message("* cllua")
elseif (args[1] == "features") then
Shared.Message("Gameplay Changes")
Shared.Message(" * Added “changeclass” command for changing your class to “buildbot”, “marine”, or “skulk”")
Shared.Message(" * Basic deathmatch functionality. You can kill other players, and get teleported back to spawn when dead.")
Shared.Message(" * K/D ratio will be shown in the hud")
Shared.Message(" * View height will be adjusted depending on which class (marine/skulk) you choose")
Shared.Message(" * Very, very experimental skulk “bite” and buildbot ‘peashooter’ weapons added")
Shared.Message(" * Added rifle autoreload")
Shared.Message(" * Added crouch ability (only slows you down since there’s no animation)")
Shared.Message(" * Skulk moves 2x as fast as marines, Buildbot has 1/2 gravity")
Shared.Message("General Changes and Fixes")
Shared.Message(" * Fixed permajump (holding jump made you keep jumping whenever you touched the ground)")
Shared.Message(" * Fixed ammo count changing before reload anim finished")
Shared.Message(" * Fix 5 second delay when a player joins a server")
Shared.Message(" * Added “nick” command for changing your name.")
Shared.Message(" * Added “stuck” command")
Shared.Message(" * Added an “invertmouse” console command")
else
Shared.Message("For more specific help, type help catagory-name")
Shared.Message("commands")
Shared.Message("features")
end
end
function OnConsoleClLua(userdata, ...)
local str = table.concat( { ... }, " " ):gsub( "%s?([%[%]\\%.%?])%s?", "%1" )
Shared.Message( "(Client) Running lua: " .. str )
local good, err = loadstring(str)
if not good then
Shared.Message( err )
return
end
good()
end
qtrm = "^\"?(.-)\"?$"
function OnKillMessage(src, killer, killed) -- Should test if this message is coming from server
killer = killer:match(qtrm)
killed = killed:match(qtrm)
KillUI_AddKill(killer,killed)
end
ClientNicks = {}
function OnClientNickMessage(src, client, nick)
ClientNicks[tonumber(client:match(qtrm))] = nick:match(qtrm)
DMsg("GOT NICK ",tonumber(client:match(qtrm))," ",nick:match(qtrm))
end Event.Hook("Console_nickmsg", OnClientNickMessage)
Event.Hook("Console_help", OnCommandHelp)
Event.Hook("Console_cllua", OnConsoleClLua)
Event.Hook("Console_kill", OnKillMessage)