mirror of
https://github.com/OgelGames/fakelib.git
synced 2025-11-05 10:35:32 +01:00
add get_guid() function to fake player
This commit is contained in:
11
player.lua
11
player.lua
@@ -82,6 +82,10 @@ local function check_vector(v)
|
||||
end
|
||||
end
|
||||
|
||||
local function new_fake_guid()
|
||||
return string.format("@fakeplayer%d%d", os.time(), math.random(100, 999))
|
||||
end
|
||||
|
||||
-- Dynamic get/set functions
|
||||
----------------------------------------
|
||||
|
||||
@@ -89,6 +93,13 @@ function fake_player:get_player_name()
|
||||
return self.data.name or ""
|
||||
end
|
||||
|
||||
function fake_player:get_guid()
|
||||
if not self.data.guid then
|
||||
self.data.guid = new_fake_guid()
|
||||
end
|
||||
return self.data.guid
|
||||
end
|
||||
|
||||
function fake_player:get_inventory()
|
||||
if not self.data.inventory then
|
||||
self.data.inventory = fakelib.create_inventory({
|
||||
|
||||
Reference in New Issue
Block a user