Difference between revisions of "User:Dr. Strangelove/ReadModule"

From RimWorld Wiki
Jump to navigation Jump to search
m
Line 1: Line 1:
local timeA = os.clock()
+
<!-- Original -->
local p = {}
+
{{infobox main|animal|
 +
|name = Hare (original way)
 +
|image = Hare.png
 +
|description = "This small, solitary herbivore can swiftly hop away from danger."
 +
|type = Animals
 +
|type2 = Wild
 +
|bodysize = 0.2
 +
|healthscale = 0.4
 +
|movespeed = 6.0
 +
|attack1dmg = 3
 +
|attack1type = bite
 +
|attack1part = teeth
 +
|attack1cool = 100
 +
|leathername = lightleather
 +
|leatheryield = 15
 +
|manhunter = 0.0125
 +
|hungerrate = 0.23
 +
|diet = herbivorous
 +
|trainable = none
 +
|wildness = 0.75
 +
|gestation = 13
 +
|lifespan = 8
 +
|offspring = 1-2
 +
|maturityage = 0.3
 +
<!--matemtbhours = 4-->
 +
|nuzzleMtb = 36
 +
|marketvalue = 50
 +
|livesin_borealforest = true
 +
|livesin_temperateforest = true
 +
|livesin_tundra = true
 +
|massadult = 14
 +
|petness = 0.08
 +
|min comfortable temperature = -30
 +
|max comfortable temperature = 40
 +
}}
  
local data = mw.loadData('Module:Test/data')
+
<!-- Automatic: invoked for each parameter value -->
 
+
{{infobox main|animal|
function find_key_in_table(find_key, in_table)
+
|name = Hare (modified way)
for key, val in pairs(in_table) do
+
|image = Hare.png
if key == find_key then return val
+
|description = {{#invoke:Test|get|description}}
elseif type(val) == "table" then
+
|type = Animals
local var = find_key_in_table(find_key, val)
+
|type2 = Wild
if var then return var end
+
|bodysize = {{#invoke:Test|get|baseBodySize}}
end
+
|healthscale = {{#invoke:Test|get|baseHealthScale}}
end
+
|movespeed = {{#invoke:Test|get|MoveSpeed}}
end
+
|attack1dmg = 3
 
+
|attack1type = bite
-- use "ParentName" to identify the parent
+
|attack1part = teeth
-- side effect (data table as parameter)
+
|attack1cool = 100
function find_using_inheritance(find_key, in_table)
+
|leathername = {{#invoke:Test|get|leatherDef}}
local found = find_key_in_table(find_key, in_table)
+
|leatheryield = 15
if found then return found
+
|manhunter = {{#invoke:Test|get|manhunterOnDamageChance}}
elseif in_table.ParentName then
+
|hungerrate = {{#invoke:Test|get|baseHungerRate}}
found = find_using_inheritance(find_key, find_key_in_table(in_table.ParentName, data))
+
|diet = {{#invoke:Test|get|foodType}}
if found then return found end
+
|trainable = {{#invoke:Test|get|trainability}}
end
+
|wildness = {{#invoke:Test|get|wildness}}
end
+
|gestation = {{#invoke:Test|get|gestationPeriodDays}}
 
+
|lifespan = {{#invoke:Test|get|lifeExpectancy}}
function p.get(frame, data)
+
|offspring = 1-2
local parent = find_key_in_table(frame.args[1], data)
+
|maturityage = 0.3
local found = find_using_inheritance(frame.args[2], parent)
+
|matemtbhours = {{#invoke:Test|get|mateMtbHours}}
return found
+
|nuzzleMtb = {{#invoke:Test|get|nuzzleMtbHours}}
end
+
|marketvalue = {{#invoke:Test|get|MarketValue}}
 
+
|livesin_borealforest = true
local timeB = os.clock()
+
|livesin_temperateforest = true
 
+
|livesin_tundra = true
mw.log(timeB-timeA)
+
|massadult = 14
 
+
|petness = {{#invoke:Test|get|petness}}
return p
+
|min comfortable temperature = {{#invoke:Test|get|ComfyTemperatureMin}}
 +
|max comfortable temperature = 40
 +
}}

Revision as of 10:19, 11 March 2021

Hare (original way)

Hare (original way)

"This small, solitary herbivore can swiftly hop away from danger."

Base Stats

Type
AnimalsWild
Market Value
50 Silver

Pawn Stats

Move Speed
6.0 c/s
Health Scale
0.4
Body Size
0.2
Mass - Baby
2.4 kg
Mass - Juvenile
6 kg
Mass - Adult
12 kg
Carrying Capacity
15 kg
Filth Rate
1
Hunger Rate
0.37 Nutrition/Day
Diet
herbivorous
Life Expectancy
8 years
Manhunter Chance
1.25%
Trainable Intelligence
None
Wildness
75%
Minimum Handling Skill
7
Nuzzle Interval
1.5 days
Maturity Age
0.3 years (18 days)
Comfortable Temp Range
-30 °C – 40 °C (-22 °F – 104 °F)

Production

Meat Yield
31 hare (original way) meat
Leather Yield
15 lightleather
Gestation Period
13 days
Offspring Per Birth
1-2

Melee Combat

Attack
Teeth
3 dmg (Bite)
4 % AP
100 second cooldown
Average DPS
0.02

Hare (modified way)

Hare (modified way)

Script error: The function "get" does not exist.

Base Stats

Type
AnimalsWild
Market Value
Expression error: Unexpected < operator. Silver

Pawn Stats

Move Speed
Script error: The function "get" does not exist. c/s
Health Scale
Script error: The function "get" does not exist.
Body Size
Script error: The function "get" does not exist.
Mass - Baby
Expression error: Unexpected < operator. kg
Mass - Juvenile
Expression error: Unexpected < operator. kg
Mass - Adult
Expression error: Unexpected < operator. kg
Carrying Capacity
Expression error: Unexpected < operator. kg
Filth Rate
1
Hunger Rate
Expression error: Unexpected < operator. Nutrition/Day
Diet
Script error: The function "get" does not exist.
Life Expectancy
Script error: The function "get" does not exist. years
Manhunter Chance
Expression error: Unexpected < operator.%
Trainable Intelligence
Script error: The function "get" does not exist.
Wildness
Expression error: Unexpected < operator.%
Minimum Handling Skill
Expression error: Unexpected < operator.
Nuzzle Interval
Expression error: Unexpected < operator.
Maturity Age
0.3 years (18 days)
Comfortable Temp Range
Expression error: Unexpected < operator. °C – 40 °C (Expression error: Unexpected < operator. °F – 104 °F)

Production

Meat Yield
Expression error: Unexpected < operator. hare (modified way) meat
Leather Yield
15 [[Script error: The function "get" does not exist.|script error: the function "get" does not exist.]]
Gestation Period
Script error: The function "get" does not exist. days
Offspring Per Birth
1-2

Melee Combat

Attack
Teeth
3 dmg (Bite)
4 % AP
100 second cooldown
Average DPS
0.02