Module:Body Part Variants

From Caves of Qud Wiki
Revision as of 21:43, 26 October 2021 by Teamtoto (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

local p = {}

local variants = {
-- Identities--
['Head'] = 'Head',
['Face'] = 'Face',
['Back'] = 'Back',
['Arm'] = 'Arm',	
['Hand'] = 'Hand',	
['Hands'] = 'Hands',	
['Feet'] = 'Feet',	
['Roots'] = 'Roots',	
['Tread'] = 'Tread',	
['Fin'] = 'Fin',	
['Missile Weapon'] = 'Missile Weapon',		
['Thrown Weapon'] = 'Thrown Weapon',
-- Autogenerated --
['Blossom'] = 'Head',
['Cap'] = 'Head',
['Centerpiece'] = 'Head',
['Central Lobe'] = 'Head',
['Central Mass'] = 'Head',
['Central Node'] = 'Head',
['Control Unit'] = 'Head',
['Ear'] = 'Head',
['Head Section'] = 'Head',
['Header'] = 'Head',
['Neck'] = 'Head',
['Nuclear Protrusion'] = 'Head',
['Pillow'] = 'Head',
['Skull'] = 'Head',
['Top Rail'] = 'Head',
['Top'] = 'Head',
['Upper Dome'] = 'Head',
['Access Panel'] = 'Face',
['Antennae'] = 'Face',
['Decoration'] = 'Face',
['Extra Face'] = 'Face',
['Faceplate'] = 'Face',
['Feelers'] = 'Face',
['Knocker'] = 'Face',
['Lip'] = 'Face',
['Pillowcase'] = 'Face',
['Sensor Array'] = 'Face',
['Sensory Bud'] = 'Face',
['Sensory Bulb'] = 'Face',
['Sensory Nodule'] = 'Face',
['Sensory Frill'] = 'Face',
['Sensory Ganglion'] = 'Face',
['Skull Face'] = 'Face',
['Splat'] = 'Face',
['Mouth'] = 'Face',
['Eye'] = 'Face',
['Blanket'] = 'Back',
['Breadth'] = 'Back',
['Case'] = 'Back',
['Chassis'] = 'Back',
['Equipment Rack'] = 'Back',
['Frame'] = 'Back',
['Membrane'] = 'Back',
['Molding'] = 'Back',
['Tablecloth'] = 'Back',
['Arm Section'] = 'Arm',
['Armature'] = 'Arm',
['Armbone'] = 'Arm',
['Bine'] = 'Arm',
['Branch'] = 'Arm',
['Fibrous Node'] = 'Arm',
['Frond'] = 'Arm',
['Hinge'] = 'Arm',
['Knot'] = 'Arm',
['Leg'] = 'Arm',
['Lobe'] = 'Arm',
['Pipe'] = 'Arm',
['Reinforcement'] = 'Arm',
['Robo-Arm'] = 'Arm',
['Side Rail'] = 'Arm',
['Stalk'] = 'Arm',
['Stem'] = 'Arm',
['Stud'] = 'Arm',
['Support Pole'] = 'Arm',
['Support Strut'] = 'Arm',
['Taproot'] = 'Arm',
['Oral Arm'] = 'Arm',
['Arm Stump'] = 'Hand',
['Bifurcation'] = 'Hand',
['Bottom Drawer'] = 'Hand',
['Divider'] = 'Hand',
['Drawer'] = 'Hand',
['Fine Root'] = 'Hand',
['Hand Section'] = 'Hand',
['Handbone'] = 'Hand',
['Handle'] = 'Hand',
['Hypha'] = 'Hand',
['Knob'] = 'Hand',
['Leaf'] = 'Hand',
['Manipulator'] = 'Hand',
['Opening'] = 'Hand',
['Pincer'] = 'Hand',
['Pinnule'] = 'Hand',
['Pseudopod'] = 'Hand',
['Rail'] = 'Hand',
['Robo-Hand'] = 'Hand',
['Shelf'] = 'Hand',
['Side Hypha'] = 'Hand',
['Side'] = 'Hand',
['Small Crack'] = 'Hand',
['Tendril'] = 'Hand',
['Tentacle'] = 'Hand',
['Tie Point'] = 'Hand',
['Top Drawer'] = 'Hand',
['Twig'] = 'Hand',
['Vane'] = 'Hand',
['Arm Stumps'] = 'Hands',
['Bifurcations'] = 'Hands',
['Hand Sections'] = 'Hands',
['Handbones'] = 'Hands',
['Knobs'] = 'Hands',
['Lateral Hyphae'] = 'Hands',
['Leaves'] = 'Hands',
['Manipulators'] = 'Hands',
['Pincers'] = 'Hands',
['Pinnules'] = 'Hands',
['Rails'] = 'Hands',
['Robo-Hands'] = 'Hands',
['Tendrils'] = 'Hands',
['Tentacles'] = 'Hands',
['Twigs'] = 'Hands',
['Vanes'] = 'Hands',
['Base'] = 'Feet',
['Bottom Rail'] = 'Feet',
['Bottom'] = 'Feet',
['Footbones'] = 'Feet',
['Foundation'] = 'Feet',
['Front Legs'] = 'Feet',
['Legs'] = 'Feet',
['Rear Legs'] = 'Feet',
['Rockers'] = 'Feet',
['Support Struts'] = 'Feet',
['Undercarriage'] = 'Feet',
['Lower Hyphae'] = 'Roots',
['Mulch'] = 'Roots',
['Stakes'] = 'Roots',
['Muscular Foot'] = 'Tail',
['Wheels'] = 'Tread',
['Wheel'] = 'Tread',
['Dorsal Fin'] = 'Fin',
['Tail Fin'] = 'Fin',
['Hardpoint'] = 'Missile Weapon',
['Middle Hardpoint'] = 'Thrown Weapon'
}

function p.gettype(part)
  return variants[part]
end

function p.gettypeframe(frame)
  return p.gettype(frame.args[1])
end

function p.listallvariantsoftype(type)
-- returns a string of a list of all body parts that are a variant of the base type.
    returntbl = {}
    for v, p in pairs(variants) do
        if p == type then --if the base type is the same, return it
            returntbl[#returntbl + 1] = v
        end
    end
    return table.concat(returntbl, ', ')
end

function p.listvariants(frame)
   return p.listallvariantsoftype(frame.args[1])
end

return p