Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Regarding stackability
- Stacking attachment should be ok as long as those
- who make the attachments follow the guidlines
- Also to note, the people who modify the guns through here are
- held responsible on account of the person/community using the addon.
- DO NOT COME TO ME FOR HELP IF THE ATTACHMENT ISN'T EVEN MINE.
- If you need help understanding the attachment system, you may do so.
- ]]
- ATTACHMENT.Name = 'BasicAtt'
- ATTACHMENT.Class = 'default_att'
- ATTACHMENT.Trivia = [[Just a basic attachment, duh]]
- ATTACHMENT.Icon = "icon16/picture_empty.png"
- ATTACHMENT.Spawnable = false -- Should it become an entity that is spawnable? (Auto generated)
- ATTACHMENT.Hidden = true -- Hide from the attachment menu (Basically unobtainable)
- --[[
- This is relative to the model of the gun.
- This means within the editor, this should be specified as an attachable region.
- This allows virutally any attachment to be attachable to that point.
- Information such as scale and size is given out from the editor to scale up or
- scale down the attachment to the gun's desired size.
- I STRONGLY RECOMMEND YOU USE A MODEL THAT SHOWS DIRECTIONS
- such as "models/maxofs2d/cube_tool.mdl"
- which is used for finding out what direction your facing the object.
- ]]
- ATTACHMENT.Attachables = {
- "default__" -- This must exist in the gun's lua generated model to be an attachable region
- }
- --[[
- Put all your models in here to be added to the attachable area
- Attachment system will automatically scale up/down any model for every gun's attachment specification.
- Making it easier for all modelers to make attachments for all guns.
- I need to find a way to scale down animation positions...
- ]]
- ATTACHMENT.Models = {
- ['VM'] = {},
- ['WM'] = {}
- }
- -- Overrides "Attachables" to a different region
- ATTACHMENT.Models_VM_Attach = "default__region"
- ATTACHMENT.Models_WM_Attach = "default__region"
- --[[
- Modify models by their name
- So let's say you wanted to change the HitMarker to be hidden.
- To do so, just look down here.
- you can use the name, uid, or even the bone.
- as defined in order by "name", "uid" and "bone"
- ]]
- ATTACHMENT.Models_Modify = {
- ['VM'] = {
- {name = 'HitMarker', effects = {
- ['Hide'] = true,
- }}
- },
- ['WM'] = {}
- }
- --[[
- Simple modification kit for players to play with.
- Basically this will allow clients to modify their attachments.
- For example, lets say you wanted to change the color of the reticle?
- Or you wanted to change a variable stock?
- This allows you to expand upon creativity.
- This data is stored in "AttachmentMetaData".
- ]]
- ATTACHMENT.Modify = {
- {
- Name = "Color",
- Type = TYPE_COLOR,
- Min = Color(0,0,0,255),
- Max = Color(255,255,255,255),
- Verify = function(self, uid, old, new)
- if new < 0 or new > 255 then return false end
- return true
- end,
- PreApply = function(self, uid, old, new)
- end,
- ShouldReloadModels = function(self, uid, value)
- return false
- end,
- PostApply = function(self, uid, old, new)
- local object = self:GetModelByUID(VM, MWB.IndexToModelUID(uid) .. ".SomeID")
- object.Color = new
- end,
- },
- {
- Name = "Size",
- Type = TYPE_NUMBER,
- Min = .5,
- Max = 2,
- Verify = function(self, uid, old, new)
- if new < .5 or new > 2 then return false end
- return true
- end,
- PreApply = function(self, uid, old, new)
- end,
- ShouldReloadModels = function(self, uid, value)
- return false
- end,
- PostApply = function(self, uid, old, new)
- local object = self:GetModelByUID(VM, MWB.IndexToModelUID(uid) .. ".SomeID")
- object.Size = new
- object:Reconstruct()
- end,
- }
- }
- --[[
- I have not planned this out yet... But meh, I will eventually
- Supposed to be some plans with my IK system to be auto intigrated here...
- ]]
- ATTACHMENT.Animations = {
- ['VM'] = {},
- ['WM'] = {}
- }
- --[[
- Basically, what this will do is grab all the bones from the attachment.
- Compare the bones to it...
- And then move the bones towards the attachment to be relative to it.
- This works in conjuction with IK system for c_arms.
- Pretty much only moving the hands to the position and letting the arms be calculated via Inverse Kinematics.
- ]]
- ATTACHMENT.BoneMergeRecalibration = false
- -- Recalibrates the bone positions to be relative to the bonemerge of the arms
- -- This can be done multiple times, just be warned that stacking same bones will cause issues with pre render processing.
- -- WIP, need to design a second hand system to the model processing to allow for modifications with BoneMerge.
- ATTACHMENT.BoneMergeTarget = '' -- UID of the object to bone merge towards.
- -- This is to configure what bones should be where...
- ATTACHMENT.BoneMergeConfiguration = {
- ['ValveBiped.Bip01_L_Hand'] = true,
- }
- -- This will disable bonemerge when an animation is being played.
- ATTACHMENT.BoneMergeDisableOnAnim = {
- [ACT_VM_RELOAD] = true,
- [ACT_VM_RELOAD_EMPTY] = true,
- [ACT_VM_RELOAD_SILENCED] = true,
- [ACT_VM_RELOAD_SILENCED_EMPTY] = true
- }
- -- Recalibrates the aimposition to be relative to the sight's attachment position and scale.
- -- If there seems to be something off, you can blame the guy who made the weapon for that.
- -- Do note that the model doesn't have to be 1:1 scale, however it is recommended for weapons that scales their attachment indexes.
- -- If you don't want to use hardcoded sights, you can use target instead.
- -- Input a UniqueID of a pac3 object into there and the sight position will be recalibrated to there instead.
- ATTACHMENT.SightRecalibration = false
- ATTACHMENT.Sights = {
- {
- Position = Vector(0, 0, 0),
- Angles = Angle(0, 0, 0),
- Target = nil,
- }
- }
- --[[
- The best part yea?
- Modular weapon effects system
- You can modify almost every aspect of the gun through here
- From functions, to vectors and numbers, this becomes your playground, literally...
- Almost all value types are supported, this includes even values that you don't
- use in lua, such as CUserCmd (not sure how you would but yea)
- Let's say you wanted to modify something that is inside a table.
- Most weapon bases don't do this, but this one can :D
- ATTACHMENT.Effects = {
- ['Primary'] = {
- ['Ammo'] = "9x19MM" -- This will change the weapon's ammo type to use 9x19MM
- }
- }
- or you wanted to change a function?
- replacing a function will automatically convert it into an intigrated hook system via hook manager.
- this ensures that if there is stackability in the function, you wont run into issues.
- ATTACHMENT.Effects = {
- ['FireBullet'] = function(self, dir)
- return
- end
- }
- If this turns out to be troublesome, there is an attachment callback system bellow all of this
- ]]
- ATTACHMENT.Effects = {}
- --[[
- Conditions are used to define how the effects will be added to a gun
- This only for vectors, angles and numbers
- In this case, "mul" means multiply and "add" is just addition
- Conditions goes as follows
- set - set a value
- mul - multiplies value
- add - adds to the value
- These are only for things like, numbers, vectors and angles.
- They follow an applying order of "set" -> "mul" -> "add"
- This is to prevent conflicting modifications of the weapons.
- So let's say we want to multiply the damage
- ATTACHMENT.Effects = {
- ['MaxDamage'] = 2
- }
- This would be the condition
- ATTACHMENT.Conditions = {
- ['MaxDamage'] = 'mul'
- }
- ]]
- ATTACHMENT.Conditions = {}
- --[[
- Simple pros and cons stuff.
- Just input what you want in there and it will show up as either positive or negative
- ]]
- ATTACHMENT.ProsCons = {
- Pros = [[]],
- Cons = [[]],
- Infos = [[]]
- }
- --[[
- These are callbacks for the attachment when being added/removed.
- Use these to your advantage if the effects system isn't enough.
- For those who are still trying to grasp "pre" vs "post"
- pre - means before the operation of attaching
- post - means after the effects/etc has been attached/overwritten
- I suggest doing this for the hook system as well
- Such as
- self:AddHook(hook, identifier, function(self, ...) end)
- self:RemoveHook(hook, identifier)
- This will allow you to modify the gun to the core, and even the dynamic bullet system.
- Let's say, you wanted to change the color of the bullet? :)
- Please understand these are called both Client and Server realms.
- self is basically the weapon entity
- uid is a bit special as it acts as 3 things.
- 1. Identification of the attachment location (like is it index 1, 2 or 3 for example)
- 2. Identification of models being added so that you can modify them (use self:UIDToModelLoc(string))
- This returns a string of the exact attachment coordinates you are looking for to modify.
- 3. A unique identifier for hooks
- ]]
- ATTACHMENT.PreAttach = function(self, uid) end
- ATTACHMENT.PostAttach = function(self, uid) end
- ATTACHMENT.PreDetach = function(self, uid) end
- ATTACHMENT.PostDetach = function(self, uid) end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement