forked from mrkubax10/industrialtest
Refactor electric sabers
This commit is contained in:
@@ -15,6 +15,9 @@
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
industrialtest.Tool=table.copy(industrialtest.Item)
|
||||
industrialtest.internal.unpackTableInto(industrialtest.Tool,{
|
||||
define={}
|
||||
})
|
||||
|
||||
function industrialtest.Tool.use(self,itemstack,user,pointed)
|
||||
-- dummy function
|
||||
@@ -22,6 +25,7 @@ function industrialtest.Tool.use(self,itemstack,user,pointed)
|
||||
end
|
||||
|
||||
function industrialtest.Tool.hitUse(self,itemstack,user,pointed)
|
||||
-- Note: this method, when used, onUse must be set in define table
|
||||
-- dummy function
|
||||
return false
|
||||
end
|
||||
@@ -59,17 +63,21 @@ function industrialtest.Tool.createDefinitionTable(self)
|
||||
def.tool_capabilities={
|
||||
uses=self.uses
|
||||
}
|
||||
def.on_place=function(itemstack,user,pointed)
|
||||
if self:onPlace(itemstack,user,pointed) then
|
||||
return itemstack
|
||||
if self.define.onPlace then
|
||||
def.on_place=function(itemstack,user,pointed)
|
||||
if self:onPlace(itemstack,user,pointed) then
|
||||
return itemstack
|
||||
end
|
||||
return nil
|
||||
end
|
||||
return nil
|
||||
end
|
||||
def.on_use=function(itemstack,user,pointed)
|
||||
if self:onUse(itemstack,user,pointed) then
|
||||
return itemstack
|
||||
if self.define.onUse then
|
||||
def.on_use=function(itemstack,user,pointed)
|
||||
if self:onUse(itemstack,user,pointed) then
|
||||
return itemstack
|
||||
end
|
||||
return nil
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
if industrialtest.mclAvailable then
|
||||
|
||||
Reference in New Issue
Block a user