Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- #######################################
- -- ## Project: Electricity Resource ##
- -- ## Name: Electricity_Bold.lua ##
- -- ## Author: Noneatme ##
- -- ## Version: 1.0 ##
- -- ## License: See top Folder ##
- -- #######################################
- -- FUNCTIONS / METHODS --
- local cFunc = {}; -- Local Functions
- local cSetting = {}; -- Local Settings
- Electricity_Bold = {};
- Electricity_Bold.__index = Electricity_Bold;
- --[[
- ]]
- -- ///////////////////////////////
- -- ///// New //////
- -- ///// Returns: Object //////
- -- ///////////////////////////////
- function Electricity_Bold:New(...)
- local obj = setmetatable({}, {__index = self});
- if obj.Constructor then
- obj:Constructor(...);
- end
- return obj;
- end
- -- ///////////////////////////////
- -- ///// Render //////
- -- ///// Returns: void //////
- -- ///////////////////////////////
- function Electricity_Bold:Render()
- for i = 1, self.length, self.abstand do
- if(self.renderPos[i]) and (self.renderPos[i+1]) then
- local x1, y1, z1 = self.renderPos[i][1], self.renderPos[i][2], self.renderPos[i][3]
- local x2, y2, z2 = self.renderPos[i+1][1], self.renderPos[i+1][2], self.renderPos[i+1][3]
- if(x1 and y1 and z1) then
- dxDrawLine3D(x1, y1, z1, x2, y2, z2, tocolor(self.color[1], self.color[2], self.color[3], self.color[4]), self.width)
- end
- end
- end
- end
- -- ///////////////////////////////
- -- ///// Constructor //////
- -- ///// Returns: void //////
- -- ///////////////////////////////
- function Electricity_Bold:Constructor(x, y, z, length, abstand, color, width)
- self.renderFunc = function() self:Render() end;
- assert(x and y and z);
- -- length: integer representing the ingame coordinates
- length = (length or 10);
- self.renderPos = {}
- self.length = length;
- self.color = (color or {0, 0, 255, 255});
- self.width = (width or 1);
- self.abstand = (abstand or 0.5)
- self.endPos = {x, y, z+length};
- for i = 1, length, self.abstand do
- self.renderPos[i] = {x+math.random(-10, 10)/10, y+math.random(-10, 10)/10, z+(length)-i};
- end
- addEventHandler("onClientRender", getRootElement(), self.renderFunc)
- outputDebugString("[CALLING] Electricity_Bold: Constructor");
- end
- -- EVENT HANDLER --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement