Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local easy_mode = [[
- # i added this for whoever is bad at lua lol.
- # HOW THIS WORKS:
- # Any line starting with # is a comment and will be ignored by the basic interpreter.
- # 'given GunNameHere', i.e. given INTERVENTION will make all following lines apply to the gun you set.
- # however, the gun name does not have to be capitalized.
- # Note that if given GunNameHere is never set, everything will just be ignored.
- # 'set ... to ...', i.e. set magsize to 1e6, will set 'magsize' to a 10^6(a one with 6zeroes)/1 million.
- # 'addmode ...' with ... being auto/burst/semi will add a firing mode to the weapon.
- # For whoever actually knows Lua, there is a function: [AddGunModifier(str GunName, table Modifier(table data_table))].
- # WARNING! The default code here changes the MK11 to an overpowered rapid firing onehit gun with infinite ammo.
- given MK11
- set magsize to 1e6
- set firerate to 1000
- set damage0 to 99
- set damage1 to 100
- set walkspeed to 50
- set name to TEST
- set penetrationdepth to 999999
- addmode auto
- given KNIFE
- set damage0 to 100
- ]]
- local AddGunModifier
- local function main()
- local global_env = (get_global_env or getrenv)() -- elysian/intriga/seven
- local old_require = require -- store our old require
- local gunmods = {}
- function AddGunModifier(gn, fn)
- gunmods[gn] = fn
- end
- global_env["require"] = function(ms)
- if type(ms) == "number" then
- return old_require(ms)
- end
- if ms.Parent == nil then -- odd action (vprim:clone!)
- if gunmods[ms.Name] then
- local actual_data = old_require(ms)
- local modified_data = gunmods[ms.Name](actual_data)
- return modified_data or actual_data
- end
- return old_require(ms)
- end
- return old_require(ms)
- end
- local ez_mods, curr_gun = {}, ""
- for line in easy_mode:gmatch("[^\r\n]+") do
- repeat
- line = line:match("^%s*(.-)%s*$")
- if line:find('#') == 1 then
- break -- ignore it.
- end
- if line:find("given ") == 1 then -- rather basic starts_with
- curr_gun = line:sub(7)
- if curr_gun then
- ez_mods[curr_gun:upper()] = {}
- else
- printconsole("pfgunmod: expected a weapon, line \"" .. line .. "\"")
- end
- break
- elseif line:find("set ") == 1 then
- local var_end_pos, val_start_pos = line:find(" to ")
- if var_end_pos == nil then
- printconsole("pfgunmod: expected 'to', line \"" .. line .. "\"")
- break
- end
- local variable_name = line:sub(5, var_end_pos - 1)
- local value = line:sub(val_start_pos)
- if tonumber(value) then
- ez_mods[curr_gun][variable_name] = tonumber(value)
- else
- ez_mods[curr_gun][variable_name] = value
- end
- break
- elseif line:find("addmode ") == 1 then
- local type_to_add = line:sub(9)
- if type_to_add == nil then
- printconsole("pfgunmod: expected firemode, line \"" .. line .. "\"")
- break
- end
- if type_to_add == "auto" then
- if ez_mods[curr_gun].firemodes then
- table.insert(ez_mods[curr_gun].firemodes, true)
- else
- ez_mods[curr_gun].firemodes = {true}
- end
- elseif type_to_add == "burst" then
- if ez_mods[curr_gun].firemodes then
- table.insert(ez_mods[curr_gun].firemodes, 3)
- else
- ez_mods[curr_gun].firemodes = {3}
- end
- elseif type_to_add == "semi" then
- if ez_mods[curr_gun].firemodes then
- table.insert(ez_mods[curr_gun].firemodes, 1)
- else
- ez_mods[curr_gun].firemodes = {1}
- end
- else
- printconsole("pfgunmod: unknown firemode, line \"" .. line .. "\"")
- end
- else
- printconsole("pfgunmod: unable to understand, line \"" .. line .. "\"")
- end
- until true -- lazy af lol
- end
- for gun, vars in pairs(ez_mods) do
- gunmods[gun] = function(data)
- for var, val in pairs(vars) do
- data[var] = val
- end
- return data
- end
- end
- end
- if game.PlaceId == 292439477 then
- main()
- AddGunModifier("KNIFE", function(data)
- data.damage0 = 100
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement