Advertisement
Guest User

Leeto Plz

a guest
Aug 24th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.92 KB | None | 0 0
  1. local easy_mode = [[
  2. # i added this for whoever is bad at lua lol.
  3. # HOW THIS WORKS:
  4. # Any line starting with # is a comment and will be ignored by the basic interpreter.
  5. # 'given GunNameHere', i.e. given INTERVENTION will make all following lines apply to the gun you set.
  6. # however, the gun name does not have to be capitalized.
  7. # Note that if given GunNameHere is never set, everything will just be ignored.
  8. # 'set ... to ...', i.e. set magsize to 1e6, will set 'magsize' to a 10^6(a one with 6zeroes)/1 million.
  9. # 'addmode ...' with ... being auto/burst/semi will add a firing mode to the weapon.
  10. # For whoever actually knows Lua, there is a function: [AddGunModifier(str GunName, table Modifier(table data_table))].
  11. # WARNING! The default code here changes the MK11 to an overpowered rapid firing onehit gun with infinite ammo.
  12. given MK11
  13. set magsize to 1e6
  14. set firerate to 1000
  15. set damage0 to 99
  16. set damage1 to 100
  17. set walkspeed to 50
  18. set name to TEST
  19. set penetrationdepth to 999999
  20. addmode auto
  21. given KNIFE
  22. set damage0 to 100
  23. ]]
  24.  
  25. local AddGunModifier
  26. local function main()
  27. local global_env = (get_global_env or getrenv)() -- elysian/intriga/seven
  28. local old_require = require -- store our old require
  29. local gunmods = {}
  30.  
  31. function AddGunModifier(gn, fn)
  32. gunmods[gn] = fn
  33. end
  34.  
  35. global_env["require"] = function(ms)
  36. if type(ms) == "number" then
  37. return old_require(ms)
  38. end
  39. if ms.Parent == nil then -- odd action (vprim:clone!)
  40. if gunmods[ms.Name] then
  41. local actual_data = old_require(ms)
  42. local modified_data = gunmods[ms.Name](actual_data)
  43. return modified_data or actual_data
  44. end
  45. return old_require(ms)
  46. end
  47. return old_require(ms)
  48. end
  49.  
  50. local ez_mods, curr_gun = {}, ""
  51. for line in easy_mode:gmatch("[^\r\n]+") do
  52. repeat
  53. line = line:match("^%s*(.-)%s*$")
  54. if line:find('#') == 1 then
  55. break -- ignore it.
  56. end
  57. if line:find("given ") == 1 then -- rather basic starts_with
  58. curr_gun = line:sub(7)
  59. if curr_gun then
  60. ez_mods[curr_gun:upper()] = {}
  61. else
  62. printconsole("pfgunmod: expected a weapon, line \"" .. line .. "\"")
  63. end
  64. break
  65. elseif line:find("set ") == 1 then
  66. local var_end_pos, val_start_pos = line:find(" to ")
  67. if var_end_pos == nil then
  68. printconsole("pfgunmod: expected 'to', line \"" .. line .. "\"")
  69. break
  70. end
  71. local variable_name = line:sub(5, var_end_pos - 1)
  72. local value = line:sub(val_start_pos)
  73. if tonumber(value) then
  74. ez_mods[curr_gun][variable_name] = tonumber(value)
  75. else
  76. ez_mods[curr_gun][variable_name] = value
  77. end
  78. break
  79. elseif line:find("addmode ") == 1 then
  80. local type_to_add = line:sub(9)
  81. if type_to_add == nil then
  82. printconsole("pfgunmod: expected firemode, line \"" .. line .. "\"")
  83. break
  84. end
  85. if type_to_add == "auto" then
  86. if ez_mods[curr_gun].firemodes then
  87. table.insert(ez_mods[curr_gun].firemodes, true)
  88. else
  89. ez_mods[curr_gun].firemodes = {true}
  90. end
  91. elseif type_to_add == "burst" then
  92. if ez_mods[curr_gun].firemodes then
  93. table.insert(ez_mods[curr_gun].firemodes, 3)
  94. else
  95. ez_mods[curr_gun].firemodes = {3}
  96. end
  97. elseif type_to_add == "semi" then
  98. if ez_mods[curr_gun].firemodes then
  99. table.insert(ez_mods[curr_gun].firemodes, 1)
  100. else
  101. ez_mods[curr_gun].firemodes = {1}
  102. end
  103. else
  104. printconsole("pfgunmod: unknown firemode, line \"" .. line .. "\"")
  105. end
  106. else
  107. printconsole("pfgunmod: unable to understand, line \"" .. line .. "\"")
  108. end
  109. until true -- lazy af lol
  110. end
  111.  
  112. for gun, vars in pairs(ez_mods) do
  113. gunmods[gun] = function(data)
  114. for var, val in pairs(vars) do
  115. data[var] = val
  116. end
  117. return data
  118. end
  119. end
  120. end
  121. if game.PlaceId == 292439477 then
  122. main()
  123. AddGunModifier("KNIFE", function(data)
  124. data.damage0 = 100
  125. end)
  126. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement