Skip to content

Commit

Permalink
Clockwork 0.94.17 Beta
Browse files Browse the repository at this point in the history
* Added DoorSetAllUnownable/DoorSetAllOwnable commands.
* *Contributed by Trurascalz.*
* Allow SQL host urls with/without http:// or https:// to be used.
* *Contributed by RJ.*
* Added check for iniTable so that the framework doesn't crash if a
plugin doesn't have an ini file.
* *Contributed by NightAngel.*
* Added checks to chatbox that solve len bug from utf8 commit.
* *Contributed by NightAngel.*
  • Loading branch information
Skiastra committed Nov 6, 2015
1 parent 41fcf03 commit 38577db
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 36 deletions.
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,38 @@ Changelog
---------
The following changes have been made for each official Clockwork build.

0.94.17
-------

* Added bitflag library.
* *Contributed by duck.*
* Linked utf-8 library with GMod utf-8 module.
* *Contributed by Kefta.*
* Added DoorSetAllUnownable/DoorSetAllOwnable commands.
* *Contributed by Trurascalz.*
* Allow SQL host urls with/without http:// or https:// to be used.
* *Contributed by RJ.*
* Added check for iniTable so that the framework doesn't crash if a plugin doesn't have an ini file.
* *Contributed by NightAngel.*
* Added checks to chatbox that solve len bug from utf8 commit.
* *Contributed by NightAngel.*

0.94.13
-------

* Added bitflag library.
* *Contributed by duck.*
* Linked utf-8 library with GMod utf-8 module.
* *Contributed by Kefta.*

0.94.1
-------

* Added plugin call for drawing salesman targetID.
* *Contributed by NightAngel.*
* Added custom ammo type saving based on ammo items, as well as AdjustAmmoTypes(ammoTable) hook for adding/removing ammo types to save.
* *Contributed by NightAngel.*

0.94
-------

Expand Down
2 changes: 1 addition & 1 deletion Clockwork/garrysmod/gamemodes/clockwork/clockwork.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"settings"
{
}
"version" "0.94.1"
"version" "0.94.17"
"author" "Cloud Sixteen"
"description" "A roleplaying framework developed by Cloud Sixteen for the people."
"workshopid" "474315121"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,14 @@ function Clockwork.chatBox:CreateDermaTextEntry()
local maxChatLength = Clockwork.config:Get("max_chat_length"):Get();
local text = textEntry:GetValue();
if (string.utf8len(text) > maxChatLength) then
textEntry:SetRealValue(string.utf8sub(text, 0, maxChatLength));
Clockwork.option:PlaySound("tick");
elseif (self:IsOpen()) then
if (text != textEntry.previousText) then
Clockwork.plugin:Call("ChatBoxTextChanged", textEntry.previousText or "", text);
if (text and text != "") then
if (string.utf8len(text) > maxChatLength) then
textEntry:SetRealValue(string.utf8sub(text, 0, maxChatLength));
Clockwork.option:PlaySound("tick");
elseif (self:IsOpen()) then
if (text != textEntry.previousText) then
Clockwork.plugin:Call("ChatBoxTextChanged", textEntry.previousText or "", text);
end;
end;
end;
Expand Down Expand Up @@ -223,12 +225,14 @@ function Clockwork.chatBox:CreateDermaTextEntry()
self.textEntry.SetRealValue = function(textEntry, text, limit)
textEntry:SetText(text);
if (limit) then
if (textEntry:GetCaretPos() > string.utf8len(text)) then
if (text and text != "") then
if (limit) then
if (textEntry:GetCaretPos() > string.utf8len(text)) then
textEntry:SetCaretPos(string.utf8len(text));
end;
else
textEntry:SetCaretPos(string.utf8len(text));
end;
else
textEntry:SetCaretPos(string.utf8len(text));
end;
end;
Expand Down Expand Up @@ -857,7 +861,7 @@ function Clockwork.chatBox:Paint()
local command = splitTable[1];
local prefix = Clockwork.config:Get("command_prefix"):Get();
if (command) then
if (command and command != "") then
for k, v in pairs(Clockwork.command.stored) do
if (string.utf8sub(k, 1, string.utf8len(command)) == string.lower(command)
and (!splitTable[2] or string.lower(command) == k)) then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,29 +367,31 @@ function Clockwork.plugin:Include(directory, bIsSchema)
if (SERVER) then
local iniDir = "gamemodes/"..Clockwork.kernel:RemoveTextFromEnd(directory, "/plugin");
local iniTable = Clockwork.config:LoadINI(iniDir.."/plugin.ini", true, true);
if (iniTable and iniTable["Plugin"]) then
iniTable = iniTable["Plugin"];
iniTable.isUnloaded = self:IsUnloaded(PLUGIN_FOLDERNAME, true);
table.Merge(PLUGIN, iniTable);
CW_SCRIPT_SHARED.plugins[pathCRC] = iniTable;
else
MsgC(Color(255, 100, 0, 255), "\n[Clockwork:Plugin] The "..PLUGIN_FOLDERNAME.." plugin has no plugin.ini!\n");
end;
if(iniTable["compatibility"]) then
local compatibility = iniTable["compatibility"];
local Name = iniTable["name"] or PLUGIN_FOLDERNAME;
local cwVersion = Clockwork.kernel:GetVersion();
local cwBuild = Clockwork.kernel:GetBuild();
local cwVersBuild = Clockwork.kernel:GetVersionBuild();
if (self:CompareVersion(compatibility, Name, cwVersion, cwBuild)) then
MsgC(Color(255, 165, 0), "\n[Clockwork:Plugin] The "..Name.." plugin ["..compatibility.."] may not be compatible with Clockwork "..cwVersBuild.."!\nYou might need to update your framework!\n");
if (iniTable) then
if (iniTable["Plugin"]) then
iniTable = iniTable["Plugin"];
iniTable.isUnloaded = self:IsUnloaded(PLUGIN_FOLDERNAME, true);
table.Merge(PLUGIN, iniTable);
CW_SCRIPT_SHARED.plugins[pathCRC] = iniTable;
else
MsgC(Color(255, 100, 0, 255), "\n[Clockwork:Plugin] The "..PLUGIN_FOLDERNAME.." plugin has no plugin.ini!\n");
end;
else
MsgC(Color(255,165,0),"\n[Clockwork:Plugin] The "..PLUGIN_FOLDERNAME.." plugin has no compatibility value set!\n");
end
if (iniTable["compatibility"]) then
local compatibility = iniTable["compatibility"];
local Name = iniTable["name"] or PLUGIN_FOLDERNAME;
local cwVersion = Clockwork.kernel:GetVersion();
local cwBuild = Clockwork.kernel:GetBuild();
local cwVersBuild = Clockwork.kernel:GetVersionBuild();
if (self:CompareVersion(compatibility, Name, cwVersion, cwBuild)) then
MsgC(Color(255, 165, 0), "\n[Clockwork:Plugin] The "..Name.." plugin ["..compatibility.."] may not be compatible with Clockwork "..cwVersBuild.."!\nYou might need to update your framework!\n");
end;
else
MsgC(Color(255,165,0),"\n[Clockwork:Plugin] The "..PLUGIN_FOLDERNAME.." plugin has no compatibility value set!\n");
end
end;
else
local iniTable = CW_SCRIPT_SHARED.plugins[pathCRC];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ end;
Clockwork.ClockworkFolder = Clockwork.ClockworkFolder or GM.Folder;
Clockwork.SchemaFolder = Clockwork.SchemaFolder or GM.Folder;
Clockwork.KernelVersion = "0.94.1";
Clockwork.KernelVersion = "0.94.17";
Clockwork.KernelBuild = "beta"
Clockwork.DeveloperVersion = true;
Clockwork.Website = "http://kurozael.com";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--[[
© 2015 CloudSixteen.com do not share, re-distribute or modify
© 2015 CloudSixteen.com do not share, re-distribute or modify
without permission of its author (kurozael@gmail.com).
Clockwork was created by Conna Wiles (also known as kurozael.)
Expand Down Expand Up @@ -174,7 +174,7 @@ function Clockwork:Initialize()
local password = self.config:Get("mysql_password"):Get();
local database = self.config:Get("mysql_database"):Get();
local dateInfo = os.date("*t");
local host = self.config:Get("mysql_host"):Get();
local host = string.gsub(self.config:Get("mysql_host"):Get(), "^http[s]?://", "", 1); -- Matches at beginning of string, matches http:// or https://, no need to check twice
local port = self.config:Get("mysql_port"):Get();
self.database:Connect(host, username, password, database, port);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
--[[
© 2015 CloudSixteen.com do not share, re-distribute or modify
without permission of its author (kurozael@gmail.com).
Clockwork was created by Conna Wiles (also known as kurozael.)
http://cloudsixteen.com/license/clockwork.html
--]]
local COMMAND = Clockwork.command:New("DoorSetAllOwnable");
COMMAND.tip = "Set all doors ownable.";
COMMAND.text = "<string Name>";
COMMAND.flags = CMD_DEFAULT;
COMMAND.access = "a";
COMMAND.arguments = 1;
-- Called when the command has been run.
function COMMAND:OnRun(player, arguments)
good_doors = 0;
for k,v in pairs(ents.GetAll()) do
if(IsValid(v) and Clockwork.entity:IsDoor(v)) then
local data = {
customName = true,
position = v:GetPos(),
entity = v,
name = table.concat(arguments or {}, " ") or ""
};
Clockwork.entity:SetDoorUnownable(data.entity, false);
Clockwork.entity:SetDoorText(data.entity, false);
Clockwork.entity:SetDoorName(data.entity, data.name);
cwDoorCmds.doorData[data.entity] = data;
cwDoorCmds:SaveDoorData();
good_doors = good_doors + 1;
end
end
Clockwork.player:Notify(player, good_doors.." doors have been set ownable.");
Clockwork.player:Notify(player, "Remember: This is ALL Doors!");
end;
COMMAND:Register();
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
--[[
© 2015 CloudSixteen.com do not share, re-distribute or modify
without permission of its author (kurozael@gmail.com).
Clockwork was created by Conna Wiles (also known as kurozael.)
http://cloudsixteen.com/license/clockwork.html
--]]
local COMMAND = Clockwork.command:New("DoorSetAllUnownable");
COMMAND.tip = "Set all doors unownable.";
COMMAND.text = "<string Name>";
COMMAND.flags = CMD_DEFAULT;
COMMAND.access = "a";
COMMAND.arguments = 1;
-- Called when the command has been run.
function COMMAND:OnRun(player, arguments)
good_doors = 0;
for k,v in pairs(ents.GetAll()) do
if(IsValid(v) and Clockwork.entity:IsDoor(v)) then
local data = {
position = v:GetPos(),
entity = v,
text = arguments[2],
name = arguments[1]
};
Clockwork.entity:SetDoorName(data.entity, data.name);
Clockwork.entity:SetDoorText(data.entity, data.text);
Clockwork.entity:SetDoorUnownable(data.entity, true);
cwDoorCmds.doorData[data.entity] = data;
cwDoorCmds:SaveDoorData();
good_doors = good_doors + 1;
end
end
Clockwork.player:Notify(player, good_doors.." doors have been set unownable.");
Clockwork.player:Notify(player, "Remember: This is ALL Doors!");
end;
COMMAND:Register();

0 comments on commit 38577db

Please sign in to comment.