Skip to content

Commit

Permalink
editor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
frnsys committed Aug 11, 2024
1 parent 19f0166 commit 0d241bc
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 20 deletions.
5 changes: 0 additions & 5 deletions hes-editor/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ For industries the unit is a bit more complicated. We use _low-income-per-capita

If you want to work on multiple worlds you can _export_ and then re-_import_ worlds to your local filesystem. This is the best way to ensure that you don't lose any data.


## Sharing

You can share your worlds at the [Steam Workshop](#).

## Reporting bugs

If you encounter any bugs with the editor, the game, or the integration of the two, please [file a report here](https://github.com/frnsys/half_earth/issues).
Expand Down
4 changes: 2 additions & 2 deletions hes-editor/src/inputs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ pub fn PercentInput(
class="numeric-input"
inputmode="decimal"
value=read.get_untracked() * 100.
on:input=move |ev| {
on:change=move |ev| {
let res = event_target_value(&ev).parse::<f32>();
if let Ok(value) = &res {
write.set(*value/100.);
Expand Down Expand Up @@ -812,7 +812,7 @@ pub fn ImageInput(
signal: (Signal<Image>, SignalSetter<Image>),
) -> impl IntoView {
let (read, write) = signal;
let help = "Images will be bundled with your exported world, so it's recommended that you make sure they aren't too big.";
let help = "Images will be bundled with your exported world, so it's recommended that you make sure they aren't too big. Recommended size is 360x240.";

let image_src = move || match read.get().data {
ImageData::File(fname) => {
Expand Down
13 changes: 6 additions & 7 deletions hes-editor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ macro_rules! infinite_list {
with!(|world, max_idx| world
.$field
.iter()
.enumerate()
.map(|(i, item)| (i, item.id))
.map(|item| item.id)
.take(*max_idx)
.collect::<Vec<_>>())
};
Expand Down Expand Up @@ -255,16 +254,16 @@ macro_rules! infinite_list {
});
}>+ New</div>
<For each=list
key=|(_, id)| *id
children=move |(i, id)| {
key=|id| *id
children=move |id| {
view! {
<div class="scroll-list-item">
<div class="remove-item tooltip-parent"
title="Ctrl-click to remove without confirmation."
on:click=move |ev| {
spawn_local(async move {
let msg = "Are you sure you want to delete this?";
let name = with!(|world| world.$field.by_idx(i).name.clone());
let name = with!(|world| world.$field[&id].name.clone());
let refs = with!(|world| crate::validate::find_references(id, crate::validate::RefKind::$single, world));
if !refs.is_empty() {
create_toast(name, refs);
Expand All @@ -279,8 +278,8 @@ macro_rules! infinite_list {
</div>
<$single
signal=create_slice(world,
move |world| world.$field.by_idx(i).clone(),
move |world, val| *world.$field.by_idx_mut(i) = val
move |world| world.$field[&id].clone(),
move |world, val| world.$field[&id] = val
) />
</div>
}
Expand Down
1 change: 1 addition & 0 deletions hes-editor/src/worlds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ pub fn WorldsMenu(world: RwSignal<World>) -> impl IntoView {
ev::keydown,
move |ev| {
if ev.key() == "s" && ev.ctrl_key() {
ev.prevent_default();
match files::save_session(&world.get()) {
Ok(_) => {
notice_toast(
Expand Down
2 changes: 1 addition & 1 deletion hes-editor/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ textarea {
#save-tip {
position: fixed;
pointer-events: none;
right: 1em;
left: 1em;
bottom: 1em;
font-size: 10px;
width: 80px;
Expand Down
1 change: 1 addition & 0 deletions hes-engine/src/projects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ impl Project {
Project {
id: Id::new_v4(),
name: "New Project".into(),
cost_modifier: 1.,
..Default::default()
}
}
Expand Down
6 changes: 3 additions & 3 deletions hes-game/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ pub const CONTENTEDNESS_PC: [isize; 6] = [0, 0, 5, 10, 20, 30];
pub const EXTINCTION_PC: [isize; 6] = [20, 10, 0, -5, -5, -10];

/// In milliseconds
pub const PROJECT_CARD_SCAN_TIME: f32 = 0.7 * 1000.;
pub const PROJECT_CARD_WITHDRAW_TIME: f32 = 1.4 * 1000.;
pub const PROCESS_CARD_SCAN_TIME: f32 = 0.5 * 1000.;
pub const PROJECT_CARD_SCAN_TIME: f32 = 0.5 * 1000.;
pub const PROJECT_CARD_WITHDRAW_TIME: f32 = 1.2 * 1000.;
pub const PROCESS_CARD_SCAN_TIME: f32 = 0.4 * 1000.;
pub const PROCESS_CARD_WITHDRAW_TIME: f32 = 0.4 * 1000.;

pub const MS_PER_YEAR: f32 = 4000.;
Expand Down
6 changes: 4 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

The project consists of two artifacts:

- The _Half-Earth Socialism_ game (both web browser and standalone app versions).
- The _Half-Earth Socialism_ game editor (both web browser and standalone app).
- The [_Half-Earth Socialism_ game](https://play.half.earth) (both web browser and standalone app versions).
- The [_Half-Earth Socialism_ editor](https://editor.half.earth) (both web browser and standalone app).

[This video walks through an example of how to use the editor.](https://youtu.be/U8rmVcehZlg)

## Overview

Expand Down

0 comments on commit 0d241bc

Please sign in to comment.