-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- improved loot_table auto-completions - improved trade_table auto-completions - added currently unused ScopeGuard - new $dynamic_template option which imports directly into the scope in which it's placed
- Loading branch information
Showing
13 changed files
with
203 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
//@ts-check | ||
import EventBus from "../EventBus"; | ||
import TabSystem from "../TabSystem"; | ||
|
||
class ScopeGuard { | ||
constructor() { | ||
EventBus.on("updateSelectedTab", () => this.installListener()); | ||
this.scope_units = []; | ||
this.installListener(); | ||
} | ||
|
||
onScopeChange(f) { | ||
let scope = new ScopeUnit(TabSystem.getCurrentNavObj()); | ||
scope.onChange = f; | ||
this.scope_units.push(scope); | ||
} | ||
|
||
installListener() { | ||
EventBus.on("updateFileNavigation", () => this.updateScope()); | ||
} | ||
|
||
updateScope() { | ||
let scope_node = TabSystem.getCurrentNavObj(); | ||
this.scope_units.forEach(s => s.update(scope_node)); | ||
} | ||
} | ||
|
||
class ScopeUnit { | ||
constructor(scope_init) { | ||
this.last_scope = scope_init; | ||
} | ||
|
||
in(scope) { | ||
while(scope !== undefined && this.last_scope !== scope) { | ||
scope = scope.parent; | ||
} | ||
|
||
return scope !== undefined; | ||
} | ||
update(scope) { | ||
if(!this.in(scope)) { | ||
console.log("[SCOPE] Changed!"); | ||
if(typeof this.onChange === "function") this.onChange(); | ||
this.last_scope = scope; | ||
} | ||
} | ||
onChange() {} | ||
} | ||
|
||
export default new ScopeGuard(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"$dynamic.list.next_index": { | ||
"condition": "$loot_table.general.conditions", | ||
|
||
"$dynamic_template": { | ||
"$key": "$dynamic.children.condition", | ||
|
||
"entity_properties": { | ||
"entity": [ "this" ], | ||
"properties":{ | ||
"on_fire": "$general.boolean" | ||
} | ||
}, | ||
"random_chance":{ | ||
"chance": "$general.decimal" | ||
}, | ||
"random_chance_with_looting":{ | ||
"chance": "$general.decimal", | ||
"looting_multiplayer": "$general.decimal" | ||
}, | ||
"random_difficulty_change":{ | ||
"default_chance": "$general.decimal", | ||
"peaceful": "$general.decimal", | ||
"hard": "$general.decimal" | ||
}, | ||
"random_regional_difficulty_chance":{ | ||
"max_chance": "$general.decimal" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"$dynamic.list.next_index": { | ||
"function": "$loot_table.general.functions", | ||
"conditions": "$loot_table.conditions", | ||
|
||
"$dynamic_template": { | ||
"$key": "$dynamic.children.function", | ||
|
||
"enchant_book_for_trading": { | ||
"base_cost": "$general.number", | ||
"base_random_cost": "$general.number", | ||
"per_level_cost": "$general.number", | ||
"per_level_random_cost": "$general.number" | ||
}, | ||
"enchant_random_gear": { | ||
"chance": "$general.decimal" | ||
}, | ||
"enchant_randomly": { | ||
"treasure": "$general.boolean" | ||
}, | ||
"enchant_with_levels": { | ||
"treasure": "$general.boolean", | ||
"levels": { | ||
"min": "$general.number", | ||
"max": "$general.number" | ||
} | ||
}, | ||
"exploration_map": { | ||
"destination": "$general.structures" | ||
}, | ||
"looting_enchant": { | ||
"count": { | ||
"min": "$general.number", | ||
"max": "$general.number" | ||
} | ||
}, | ||
"set_banner_details": { | ||
"type": { | ||
"min": "$general.number", | ||
"max": "$general.number" | ||
} | ||
}, | ||
"set_count": { | ||
"count": { | ||
"min": "$general.number", | ||
"max": "$general.number" | ||
} | ||
}, | ||
"set_damage": { | ||
"damage": { | ||
"min": "$general.decimal", | ||
"max": "$general.decimal" | ||
} | ||
}, | ||
"set_data": { | ||
"data": { | ||
"min": "$general.number", | ||
"max": "$general.number" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"conditions": [ | ||
"entity_properties", "killed_by_player", "killed_by_player_or_pets", "random_chance", "random_chance_with_looting", "random_difficulty_chance", "random_regional_difficulty_chance" | ||
], | ||
"functions": [ | ||
"enchant_book_for_trading", "enchant_random_gear", "enchant_randomly", "enchant_with_levels", "exploration_map", "furnace_smelt", "looting_enchant", "set_banner_details", "set_count", "set_damage", "set_data", "set_data_from_color_index" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters