Created
September 8, 2017 17:49
-
-
Save AbigailBuccaneer/1faa65b1a8305b7f6e03005f17398ac9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Loading this file (by placing it in lua/autorun, for example) will cause all | |
-- calls to entity:SetMaxHealth() to be duplicated (by all duplicators). | |
-- | |
-- Caution! This code has never been tested. It's never even been executed. | |
-- | |
-- To the extent possible under law, the author(s) have dedicated all copyright | |
-- and related and neighboring rights to this software to the public domain | |
-- worldwide. This software is distributed without any warranty. | |
do | |
local entity = assert(FindMetaTable("Entity")) | |
local f = assert(meta.SetMaxHealth) | |
duplicator.RegisterEntityModifier("MaxHealth", function(player, entity, data) | |
f(entity, data.value) | |
end) | |
function entity:SetMaxHealth(value) | |
f(self, value) | |
duplicator.StoreEntityModifier(self, "MaxHealth", { value = value }) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment