forked from mtcontrib/maidroid
Merge pull request #158 from Rui-Minetest/remove_product_name
Remove self.product_name
This commit is contained in:
commit
74654691dd
@ -370,7 +370,7 @@ function maidroid.register_maidroid(product_name, def)
|
|||||||
|
|
||||||
-- create_inventory creates a new inventory, and returns it.
|
-- create_inventory creates a new inventory, and returns it.
|
||||||
local function create_inventory(self)
|
local function create_inventory(self)
|
||||||
self.inventory_name = self.product_name .. "_" .. tostring(self.manufacturing_number)
|
self.inventory_name = product_name .. "_" .. tostring(self.manufacturing_number)
|
||||||
local inventory = minetest.create_detached_inventory(self.inventory_name, {
|
local inventory = minetest.create_detached_inventory(self.inventory_name, {
|
||||||
on_put = function(inv, listname, index, stack, player)
|
on_put = function(inv, listname, index, stack, player)
|
||||||
if listname == "core" then
|
if listname == "core" then
|
||||||
@ -467,7 +467,6 @@ function maidroid.register_maidroid(product_name, def)
|
|||||||
local function on_activate(self, staticdata)
|
local function on_activate(self, staticdata)
|
||||||
-- parse the staticdata, and compose a inventory.
|
-- parse the staticdata, and compose a inventory.
|
||||||
if staticdata == "" then
|
if staticdata == "" then
|
||||||
self.product_name = product_name
|
|
||||||
self.manufacturing_number = maidroid.manufacturing_data[product_name]
|
self.manufacturing_number = maidroid.manufacturing_data[product_name]
|
||||||
maidroid.manufacturing_data[product_name] = maidroid.manufacturing_data[product_name] + 1
|
maidroid.manufacturing_data[product_name] = maidroid.manufacturing_data[product_name] + 1
|
||||||
create_inventory(self)
|
create_inventory(self)
|
||||||
@ -478,7 +477,6 @@ function maidroid.register_maidroid(product_name, def)
|
|||||||
-- if static data is not empty string, this object has beed already created.
|
-- if static data is not empty string, this object has beed already created.
|
||||||
local data = minetest.deserialize(staticdata)
|
local data = minetest.deserialize(staticdata)
|
||||||
|
|
||||||
self.product_name = data["product_name"]
|
|
||||||
self.manufacturing_number = data["manufacturing_number"]
|
self.manufacturing_number = data["manufacturing_number"]
|
||||||
self.nametag = data["nametag"]
|
self.nametag = data["nametag"]
|
||||||
self.owner_name = data["owner_name"]
|
self.owner_name = data["owner_name"]
|
||||||
@ -508,7 +506,6 @@ function maidroid.register_maidroid(product_name, def)
|
|||||||
local function get_staticdata(self)
|
local function get_staticdata(self)
|
||||||
local inventory = self:get_inventory()
|
local inventory = self:get_inventory()
|
||||||
local data = {
|
local data = {
|
||||||
["product_name"] = self.product_name,
|
|
||||||
["manufacturing_number"] = self.manufacturing_number,
|
["manufacturing_number"] = self.manufacturing_number,
|
||||||
["nametag"] = self.nametag,
|
["nametag"] = self.nametag,
|
||||||
["owner_name"] = self.owner_name,
|
["owner_name"] = self.owner_name,
|
||||||
@ -613,7 +610,6 @@ function maidroid.register_maidroid(product_name, def)
|
|||||||
|
|
||||||
-- extra initial properties
|
-- extra initial properties
|
||||||
pause = false,
|
pause = false,
|
||||||
product_name = "",
|
|
||||||
manufacturing_number = -1,
|
manufacturing_number = -1,
|
||||||
owner_name = "",
|
owner_name = "",
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user