Skip to content

Commit

Permalink
chore!: migrate legacy unit (#3312)
Browse files Browse the repository at this point in the history
* feat: legacy unit migration script

* feat: volume migration script

* feat: migrate legacy weight

* feat: currency migration script

* fix: attempt transformation on all schemas

* feat: bionic migration script

* test: verify that all schemas are tried

* build: bump std to `0.208.0`

* refactor: migrate legacy volumes

* chore: normalize integers in JSON

due javascript having no distinction between int and float,
parsing and saving 1.0 will not be idempotent.
thus we rewrite all instances of 'integer floats' into actual integers.

* refactor: migrate legacy mass

* refactor: migrate legacy currency

* refactor: migrate legacy energy

* chore: data migration script

for posterity

* chore: lint

---------

Co-authored-by: nocontribute <>
  • Loading branch information
scarf005 authored Dec 2, 2023
1 parent 8236a1e commit 2703a29
Show file tree
Hide file tree
Showing 577 changed files with 11,455 additions and 10,994 deletions.
2 changes: 1 addition & 1 deletion data/json/achievements.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"id": "achievement_kill_zombie",
"type": "achievement",
"name": { "str": "[Combat] One Down, Billions to Go\u2026" },
"name": { "str": "[Combat] One Down, Billions to Go" },
"kill_requirements": [ { "species": "ZOMBIE", "is": ">=", "count": 1 } ],
"requirements": [ { "event_statistic": "num_avatar_zombie_kills", "is": "anything" } ]
},
Expand Down
18 changes: 9 additions & 9 deletions data/json/bionics.json
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@
"name": { "str": "Sonic Resonator" },
"description": "Your entire body may resonate at very high power, creating a short-range shockwave. While it will not do much damage to creatures, solid objects such as walls and doors will be damaged.",
"occupied_bodyparts": [ [ "torso", 15 ], [ "head", 1 ], [ "arm_l", 2 ], [ "arm_r", 2 ], [ "leg_l", 4 ], [ "leg_r", 4 ] ],
"act_cost": 100
"act_cost": "100 kJ"
},
{
"id": "bio_scent_mask",
Expand Down Expand Up @@ -912,7 +912,7 @@
"name": { "str": "Shockwave Generator" },
"description": "You generate a powerful shockwave, knocking back all nearby creatures. Targets are stunned briefly, take damage and additional stun upon impact with impassable terrain, and knockback any creatures they collide with.",
"occupied_bodyparts": [ [ "torso", 20 ] ],
"act_cost": 250
"act_cost": "250 kJ"
},
{
"id": "bio_sleepy",
Expand Down Expand Up @@ -1007,7 +1007,7 @@
"name": { "str": "Teleportation Unit" },
"description": "This highly experimental unit folds space over short distances, instantly transporting your body up to 25 feet at the cost of much power. Note that prolonged or frequent use may have dangerous side effects.",
"occupied_bodyparts": [ [ "torso", 16 ], [ "arm_l", 3 ], [ "arm_r", 3 ], [ "leg_l", 4 ], [ "leg_r", 4 ] ],
"act_cost": 250
"act_cost": "250 kJ"
},
{
"id": "bio_thumbs",
Expand Down Expand Up @@ -1035,7 +1035,7 @@
[ "foot_l", 1 ],
[ "foot_r", 1 ]
],
"act_cost": 50
"act_cost": "50 kJ"
},
{
"id": "bio_tools",
Expand Down Expand Up @@ -1228,7 +1228,7 @@
"description": "Installed on your back is a set of retractable, reinforced solar panels resembling angular butterfly wings. When in direct sunlight, they will automatically deploy and slowly recharge your power level.",
"occupied_bodyparts": [ [ "torso", 10 ] ],
"fuel_options": [ "sunlight" ],
"fuel_efficiency": 1.0,
"fuel_efficiency": 1,
"time": 1,
"flags": [ "BIONIC_POWER_SOURCE", "BIONIC_TOGGLED" ]
},
Expand All @@ -1241,7 +1241,7 @@
"occupied_bodyparts": [ [ "hand_r", 3 ] ],
"fake_item": "afs_bionic_rocket",
"flags": [ "BIONIC_TOGGLED", "BIONIC_WEAPON" ],
"act_cost": 5
"act_cost": "5 kJ"
},
{
"id": "afs_bio_linguistic_coprocessor",
Expand All @@ -1257,8 +1257,8 @@
"description": "Tiny cybernetic stimulators have been installed throughout your ventral tegmental area, and trigger at set intervals using bionic power. This slowly releases a stream of reward chemicals and hormones into your brain, inducing a state of euphoria that notably elevates mood.",
"occupied_bodyparts": [ [ "head", 5 ] ],
"flags": [ "BIONIC_TOGGLED", "BIONIC_SLEEP_FRIENDLY" ],
"act_cost": 5,
"react_cost": 5,
"act_cost": "5 kJ",
"react_cost": "5 kJ",
"time": 200
},
{
Expand All @@ -1267,7 +1267,7 @@
"name": { "str": "Fusion Blaster Arm" },
"description": "Heavy-duty fusion blaster was integrated ino your left arm! You may use your energy banks to fire a damaging heat ray.",
"occupied_bodyparts": [ [ "arm_l", 20 ], [ "hand_l", 5 ] ],
"act_cost": 50,
"act_cost": "50 kJ",
"fake_item": "bio_blaster_gun",
"flags": [ "BIONIC_GUN", "BIONIC_NPC_USABLE" ]
},
Expand Down
4 changes: 2 additions & 2 deletions data/json/furniture_and_terrain/furniture-fakes.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"color": "red",
"move_cost_mod": 2,
"required_str": -1,
"workbench": { "multiplier": 1.0, "mass": 5000, "volume": "10L" }
"workbench": { "multiplier": 1, "mass": "5 kg", "volume": "10L" }
},
{
"type": "furniture",
Expand All @@ -25,7 +25,7 @@
"bash": { "str_min": 0, "str_max": 0, "items": [ ] },
"flags": [ "PLACE_ITEM", "TRANSPARENT", "EASY_DECONSTRUCT", "NOCOLLIDE" ],
"examine_action": "workbench",
"workbench": { "multiplier": 0.7, "mass": 1000000, "volume": "1000L" }
"workbench": { "multiplier": 0.7, "mass": "1000 kg", "volume": "1000L" }
},
{
"type": "furniture",
Expand Down
4 changes: 2 additions & 2 deletions data/json/furniture_and_terrain/furniture-medical.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"required_str": -1,
"flags": [ "TRANSPARENT", "AUTODOC", "CONTAINER" ],
"examine_action": "autodoc",
"surgery_skill_multiplier": 1.0,
"surgery_skill_multiplier": 1,
"deconstruct": {
"items": [
{ "item": "autodoc", "count": 1 },
Expand Down Expand Up @@ -191,7 +191,7 @@
]
},
"examine_action": "workbench",
"workbench": { "multiplier": 1.15, "mass": 300000, "volume": "100L" }
"workbench": { "multiplier": 1.15, "mass": "300 kg", "volume": "100L" }
},
{
"type": "furniture",
Expand Down
20 changes: 10 additions & 10 deletions data/json/furniture_and_terrain/furniture-surfaces.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
]
},
"examine_action": "workbench",
"workbench": { "multiplier": 1.1, "mass": 200000, "volume": "75L" }
"workbench": { "multiplier": 1.1, "mass": "200 kg", "volume": "75L" }
},
{
"type": "furniture",
Expand All @@ -50,7 +50,7 @@
]
},
"examine_action": "workbench",
"workbench": { "multiplier": 1.1, "mass": 200000, "volume": "75L" }
"workbench": { "multiplier": 1.1, "mass": "200 kg", "volume": "75L" }
},
{
"type": "furniture",
Expand Down Expand Up @@ -131,7 +131,7 @@
]
},
"examine_action": "workbench",
"workbench": { "multiplier": 1.1, "mass": 200000, "volume": "75L" }
"workbench": { "multiplier": 1.1, "mass": "200 kg", "volume": "75L" }
},
{
"type": "furniture",
Expand Down Expand Up @@ -159,7 +159,7 @@
]
},
"examine_action": "workbench",
"workbench": { "multiplier": 1.2, "mass": 500000, "volume": "200L" }
"workbench": { "multiplier": 1.2, "mass": "500 kg", "volume": "200L" }
},
{
"type": "furniture",
Expand All @@ -181,7 +181,7 @@
"items": [ { "item": "leather_tarp", "count": [ 1, 1 ] } ]
},
"examine_action": "workbench",
"workbench": { "multiplier": 0.85, "mass": 500000, "volume": "500L" }
"workbench": { "multiplier": 0.85, "mass": "500 kg", "volume": "500L" }
},
{
"type": "furniture",
Expand All @@ -203,7 +203,7 @@
"items": [ { "item": "plastic_sheet", "count": 1 } ]
},
"examine_action": "workbench",
"workbench": { "multiplier": 0.85, "mass": 500000, "volume": "500L" }
"workbench": { "multiplier": 0.85, "mass": "500 kg", "volume": "500L" }
},
{
"type": "furniture",
Expand All @@ -225,7 +225,7 @@
"items": [ { "item": "fiber_mat", "count": [ 1, 1 ] } ]
},
"examine_action": "workbench",
"workbench": { "multiplier": 0.85, "mass": 500000, "volume": "500L" }
"workbench": { "multiplier": 0.85, "mass": "500 kg", "volume": "500L" }
},
{
"type": "furniture",
Expand Down Expand Up @@ -253,7 +253,7 @@
]
},
"examine_action": "workbench",
"workbench": { "multiplier": 1.05, "mass": 100000, "volume": "35L" }
"workbench": { "multiplier": 1.05, "mass": "100 kg", "volume": "35L" }
},
{
"type": "furniture",
Expand All @@ -280,7 +280,7 @@
]
},
"examine_action": "workbench",
"workbench": { "multiplier": 1.1, "mass": 200000, "volume": "75L" }
"workbench": { "multiplier": 1.1, "mass": "200 kg", "volume": "75L" }
},
{
"type": "furniture",
Expand Down Expand Up @@ -308,6 +308,6 @@
]
},
"examine_action": "workbench",
"workbench": { "multiplier": 0.85, "mass": 200000, "volume": "75L" }
"workbench": { "multiplier": 0.85, "mass": "200 kg", "volume": "75L" }
}
]
6 changes: 3 additions & 3 deletions data/json/game_balance.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@
"name": "PLAYER_HUNGER_RATE",
"info": "Set base hunger rate per 5 minutes. Default: 1.0",
"stype": "float",
"value": 1.0
"value": 1
},
{
"type": "EXTERNAL_OPTION",
"name": "PLAYER_THIRST_RATE",
"info": "Set base thirst rate per 5 minutes. Default: 1.0",
"stype": "float",
"value": 1.0
"value": 1
},
{
"type": "EXTERNAL_OPTION",
"name": "PLAYER_FATIGUE_RATE",
"info": "Set base fatigue rate per 5 minutes. Default: 1.0",
"stype": "float",
"value": 1.0
"value": 1
},
{
"type": "EXTERNAL_OPTION",
Expand Down
Loading

0 comments on commit 2703a29

Please sign in to comment.