• Plugin Information
  • 51 subscribers
  • Verified
  • Stable
  • Clockwork
  • Version: 1
    Upload Date: 12.23.14
    Initial Commit
  • Download
  • You need to login to download plugins to your server!
    Diseases framework by Atebite

    This is a framework! This means you're given the tools to create your own diseases, not a set of premade diseases

    The plugin adds a disease framework to Clockwork. The framework is developer-oriented, with ease of making your own diseases in mind. The framework handles everything from incubation periods, infection, making vaccines etc. All the developer has to do is write the code for what happens to the infected.

    The plugin comes with a two diseases by default, regular cold and blindness.

    For developers

    The framework includes its own library, and a couple of hooks. Utilizing them, you can create even more powerful and influential diseases, or you can make the diseases part of anything else on the server, be it through infection by usage of items or curing all of a player's diseases as they touch an entity.

    Creating diseases

    Creating a new disease is easy, and if you've made items (I hope you have), this'll be familiar.

    Here's a skeleton for diseases:

    local DISEASE = Clockwork.disease:New("DiseaseName"); -- Create our new disease. DISEASE.description = "A disease."; -- The description for the disease. DISEASE.incubationTime = 5*60; -- The disease's incubation time in seconds. During incubation the disease is infectuous but the player will not experience symptoms. DISEASE.chronic = false; -- Whether or not the disease is chronic (life lasting). DISEASE.extraSickTime = 0; -- How much extra time in hours it'll take before a disease automatically wears off. DISEASE.immuneFactions = {} -- Names of factions to be immune to the disease. Characters in these factions will be made immune upon spawn. DISEASE.infectuous = true; -- Whether or not the disease is infectuous. DISEASE.transmissionType = "airborne"; -- How the disease transmits and infects others. You can pick contact, airborne or hybrid (contact & airborne mix). DISEASE.severity = 0; -- Severity affects how often temporary effects/symptoms occur. DISEASE.lethality = 0; -- Lethality (if enabled) will drain a player's health over time. Higher lethality means more damage.

    -- This is called when a player loads their character, like with incubation end, you can use this to apply appropriate visual effects. function DISEASE:OnInit()

    end;

    -- Executed when a player unloads their character, should be used for things like removing visual effects, etc. function DISEASE:OnUnload()

    end;

    -- This code is executed every single think, and is for symptoms that are constantly there. function DISEASE:PersistEffect(player)

    end;

    -- This code is executed only every once in a while, and is for symptoms that take place with breaks in between. function DISEASE:OnTemporaryEffect(player)

    end;

    -- This code is executed when the disease's incubation period ends, and can be used to apply visual effects, etc. function DISEASE:OnIncubationEnd(player)

    end; DISEASE:Register(); -- Register our disease.

    Disease library

    The class table in this library is refered to as DISEASE.

    -- A function to register a new disease. DISEASE:Register()

    -- A function to set up or reset a player's disease info. Clockwork.disease:EstablishPlayerDiseaseInfo(player)

    -- A function to get whether a player is sick or not. Clockwork.disease:IsPlayerSick(player)

    -- A function to get whether a player is sick with a certain disease or not. Clockwork.disease:IsPlayerSickWith(player, diseaseName)

    -- A function to set a value for a player's disease info. Clockwork.disease:SetDiseaseData(player, key, value)

    -- A function to get a player's disease info. Clockwork.disease:GetDiseaseInfo(player)

    -- A function to get a player's diseases. Clockwork.disease:GetPlayerDiseases(player)

    -- A function to get a player's protection against infection. Clockwork.disease:GetInfectionProtection(player)

    -- A function to infect a player with a disease. Clockwork.disease:InfectPlayer(player, diseaseName, bLog)

    -- A function to cure a player of a disease. Clockwork.disease:CurePlayer(player, diseaseName, bLog)

    -- A function to make a player completely healthy (cure the player of all diseases). Clockwork.disease:MakePlayerHealthy(player, bLog)

    -- A function to make a player immune to a disease. Clockwork.disease:MakePlayerImmune(player, diseaseName, bLog)

    -- A function to set a player's immunities. Clockwork.disease:SetPlayerImmunities(player, immunities)

    -- A function wipe all of a player's immunities. Clockwork.disease:WipePlayerImmunities(player)

    -- A function to execute a disease's init function. function Clockwork.disease:DoDiseaseInit(player, diseaseName)

    -- A function to execute a disease's unload function. function Clockwork.disease:DoDiseaseUnload(player, diseaseName)

    -- A function to cause a temporary effect on a player. Clockwork.disease:TriggerTempEffect(player, diseaseName)

    -- A function to execute the persist effect. Clockwork.disease:DoPersistEffect(player, diseaseName)

    -- A function to end a disease's incubation period. Clockwork.disease:EndIncubation(player, diseaseName)

    -- A function to get a disease as a regular table. Clockwork.disease:GetTableVersion(diseaseInfo)

    -- A function to create a new vaccine based on a disease. Clockwork.disease:MakeVaccine(diseaseInfo)

    -- A function to create a new pathogen syringe based on a disease. Clockwork.disease:MakePathogenSyringe(diseaseInfo)

    -- A function to register a new disease. Clockwork.disease:Register(data, name)

    -- A function to create a new disease. Clockwork.disease:New(name)

    -- A function to get a string in uniqueID format. Clockwork.disease:uniqueIDFormat(text)

    -- A function to find a disease by an identifier. Clockwork.disease:FindByID(identifier)

    -- A function to get all diseases. Clockwork.disease:GetAll()

    -- A function to create a disease contact timer. Clockwork.disease:ContactTimer(player, entity, delay, distance, Condition, Callback)

    Hooks (Server)

    -- Called when a player takes damage from a disease. function Clockwork:OnPlayerTakeDiseaseDamage(player, damageAmount, diseaseInfo) end;

    Hooks (Shared)

    -- Called when a player has their disease info established. function Clockwork:PlayerDiseaseInfoEstablished(player, characterDiseaseInfo) end;

    -- Called when a player is infected with a disease. function Clockwork:OnPlayerInfected(player, diseaseInfo) end;

    -- Called when a player's disease's incubation period ends. function Clockwork:OnDiseaseIncubationEnd(player, diseaseInfo) end;

    -- Called when a player experiences a temporary effect from a disease. function Clockwork:OnPlayerExperienceDiseaseTempEffect(player, diseaseInfo) end;

    Rating

    Comments

    Comment from: Soret 02-02-2016 12:56:15

    I think this is one of the most invasive hindering elements ever created, try make it less affecting on players roleplay by not runing that like Ebola.

    Comment from: mayr mulfurd memeswell 28-07-2016 17:58:37