Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ShamanObject = function()
- local this = {}
- __init__=function()
- this.objects={}
- return this
- end
- this.add=function(...)
- local id,type,x,y,angle,vx,vy,alpha,count = ...
- if id==nil then return error('O id do objeto não pode ser nulo.') end
- if type==nil then type=0 end
- if x==nil then x=0 end
- if y == nil then y=0 end
- if angle == nil then angle=0 end
- if vx==nil then x=0 end
- if vy == nil then y=0 end
- if alpha==nil then x=false end
- if count == nil then count=1 end
- if not this.objects[id] then this.objects[id]={spawneds={},objects={}} end
- table.insert(this.objects[id].objects,{id=id,type=type,x=x,y=y,angle=angle,vx=vx,vy=vy,alpha=alpha,count=count})
- return this
- end
- this.remove=function(id)
- if id == nil or id == all then
- for _,id in pairs(this.objects) do
- for _,object in pairs(id.spawneds) do
- tfm.exec.removeObject(object)
- end
- end
- this.objects={}
- else
- for _,object in pairs(this.objects[id].spawneds) do
- tfm.exec.removeObject(object)
- end
- this.objects[id]={spawneds={},objects={}}
- end
- return this
- end
- this.spawn=function(id)
- if id == nil or id == all then
- for _,id in pairs(this.objects) do
- for index,object in ipairs(id.objects) do
- for i=1,object.count do
- this.objects[object.id].spawneds[#this.objects[object.id].spawneds+1] = tfm.exec.addShamanObject(object.type,object.x,object.y)
- table.remove(this.objects[object.id].objects,index)
- end
- end
- end
- end
- return this
- end
- return __init__()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement