Small Bugs Fixed

This commit is contained in:
Cooldude2606
2019-02-01 23:23:09 +00:00
parent 18cf8c79f4
commit a15875d8a0
5 changed files with 33 additions and 35 deletions

View File

@@ -40,6 +40,7 @@ function Admin.jail(player,by_player,reason)
['Reason:']=reason
} end
Role.meta.last_jail = player.name
player.vehicle = nil
Server.interface(Role.assign,true,player,'Jail',by_player.name)
Server.interface(Role.unassign,true,player,Role.get(player),by_player.name)
end

View File

@@ -43,7 +43,7 @@ function Admin.create_reason(reason,name)
reason = reason or 'No Reason'
if not string.find(string.lower(reason),string.lower(name)) then reason = reason..' - '..name end
if Sync and Sync.info.date ~= '0000/00/00' and not string.find(string.lower(reason),Sync.info.date) then reason = reason..' - '..Sync.info.date end
if not string.find(string.lower(reason),'appeal') then reason = reason..' - Vist www.explosivegaming.nl to appeal.' end
if not string.find(string.lower(reason),'appeal') then reason = reason..' - Visit www.explosivegaming.nl to appeal.' end
return reason
end

View File

@@ -2,8 +2,8 @@
too-many-homes=You have too many homes, to add more you must remove one. Your max is __1__.
homes=Your Homes: (__1__/__2__)
home=__1__) __2__: __3__ , __4__
set=Your home "__1__" as been set to __2__ , __3__
remove=Your home "__1__" as been removed
set=Your home "__1__" has been set to __2__ , __3__
remove=Your home "__1__" has been removed
goto=You are now at "__1__"
return=You are now at your previous location: __1__ , __2__
invalid=Invalid name, __1__

View File

@@ -272,6 +272,27 @@ function table.deepcopy(object)
return _copy(object)
end
--- Default table comparator sort function.
-- @local
-- @param x one comparator operand
-- @param y the other comparator operand
-- @return true if x logically comes before y in a list, false otherwise
local function sortFunc(x, y) --sorts tables with mixed index types.
local tx = type(x)
local ty = type(y)
if tx == ty then
if type(x) == 'string' then
return string.lower(x) < string.lower(y)
else
return x < y
end
elseif tx == 'number' then
return true --only x is a number and goes first
else
return false --only y is a number and goes first
end
end
--- Returns a copy of all of the values in the table.
-- @tparam table tbl the table to copy the keys from, or an empty table if tbl is nil
-- @tparam[opt] boolean sorted whether to sort the keys (slower) or keep the random order from pairs()
@@ -293,19 +314,7 @@ function table.values(tbl, sorted, as_string)
end
end
if sorted then
table.sort(valueset,
function(x, y) --sorts tables with mixed index types.
local tx = type(x) == 'number'
local ty = type(y) == 'number'
if tx == ty then
return x < y and true or false --similar type can be compared
elseif tx == true then
return true --only x is a number and goes first
else
return false --only y is a number and goes first
end
end
)
table.sort(valueset,sortFunc)
end
return valueset
end
@@ -331,19 +340,7 @@ function table.keys(tbl, sorted, as_string)
end
end
if sorted then
table.sort(keyset,
function(x, y) --sorts tables with mixed index types.
local tx = type(x) == 'number'
local ty = type(y) == 'number'
if tx == ty then
return x < y and true or false --similar type can be compared
elseif tx == true then
return true --only x is a number and goes first
else
return false --only y is a number and goes first
end
end
)
table.sort(keyset,sortFunc)
end
return keyset
end

View File

@@ -103,8 +103,8 @@ function ThisModule.make_warp_point(position,surface,force,warpName)
icon={type='item',name=warp_item}
})
global.warps[warpName] = {tag=tag,surface=surface.index,position=tag.position,old_tile=old_tile}
local _temp = {Spawn=global.warps.Spawn}
global.warps.Spawn = nil
local _temp = {spawn=global.warps.spawn}
global.warps.spawn = nil
for name,data in pairs(table.keysort(global.warps)) do _temp[name] = data end
global.warps = _temp
ThisModule.Gui()
@@ -163,7 +163,7 @@ ThisModule.Gui = Gui.left{
}
for name,warp in pairs(global.warps) do
if not warp.tag or not warp.tag.valid then
player.force.add_chart_tag(game.surfaces[warp.surface],{
warp.tag = player.force.add_chart_tag(game.surfaces[warp.surface],{
position=warp.position,
text='Warp: '..name,
icon={type='item',name=warp_item}
@@ -181,7 +181,7 @@ ThisModule.Gui = Gui.left{
local btn = go_to_warp(_flow)
btn.style.height = 20
btn.style.width = 20
if not Role and player.admin and name ~= 'Spawn' or Role and Role.allowed(player,'make-warp') and name ~= 'Spawn' then
if not Role and player.admin and name ~= 'spawn' or Role and Role.allowed(player,'make-warp') and name ~= 'spawn' then
local btn = remove_warp(_flow)
btn.style.height = 20
btn.style.width = 20
@@ -239,10 +239,10 @@ script.on_event(defines.events.on_player_created, function(event)
player.force.chart(player.surface, {{player.position.x - 20, player.position.y - 20}, {player.position.x + 20, player.position.y + 20}})
local tag = player.force.add_chart_tag(player.surface,{
position={0,0},
text='Warp: Spawn',
text='Warp: spawn',
icon={type='item',name=warp_item}
})
global.warps['Spawn'] = {tag=tag,surface=player.surface.index,position={x=0,y=0}}
global.warps['spawn'] = {tag=tag,surface=player.surface.index,position={x=0,y=0}}
end
end)