From ecce123299cf793f3bf772dd168f6c41da1aa196 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Fri, 6 Aug 2021 21:43:50 +0900 Subject: [PATCH] spawning of dropped item --- assets/mods/basegame/blocks/blocks.csv | 96 +++++++++---------- .../terrarum/gameactors/ActorWithBody.kt | 2 +- .../torvald/terrarum/gameactors/WireActor.kt | 4 +- .../torvald/terrarum/gameworld/GameWorld.kt | 14 +-- .../terrarum/modulebasegame/BuildingMaker.kt | 6 +- .../gameactors/ActorHumanoid.kt | 3 - .../modulebasegame/gameactors/DroppedItem.kt | 80 +++++++++++++--- .../modulebasegame/gameactors/FixtureBase.kt | 16 ++-- .../gameitems/PickaxeGeneric.kt | 9 +- 9 files changed, 140 insertions(+), 90 deletions(-) diff --git a/assets/mods/basegame/blocks/blocks.csv b/assets/mods/basegame/blocks/blocks.csv index 5b62aedb0..f1d30bc21 100644 --- a/assets/mods/basegame/blocks/blocks.csv +++ b/assets/mods/basegame/blocks/blocks.csv @@ -49,60 +49,60 @@ "147";"147";"BLOCK_ICE_CLEAR_MAGICAL";"0.1252";"0.1252";"0.1252";"0.1252";"48";"3720";"ICEX";"1";"0";"1";"N/A";"0";"0";"4";"0.0744";"0.1252";"0.2268";"0.0000";"N/A";"N/A";"0.0" "148";"148";"BLOCK_GLASS_CRUDE";"0.0876";"0.0424";"0.0876";"0.1252";"5";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" "149";"149";"BLOCK_GLASS_CLEAN";"0.0424";"0.0424";"0.0424";"0.0636";"5";"2203";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"160";"160";"BLOCK_PLATFORM_STONE";"0.0312";"0.0312";"0.0312";"0.0312";"5";"N/A";"ROCK";"0";"1";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"161";"161";"BLOCK_PLATFORM_WOODEN";"0.0312";"0.0312";"0.0312";"0.0312";"5";"N/A";"WOOD";"0";"1";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"162";"162";"BLOCK_PLATFORM_EBONY";"0.0312";"0.0312";"0.0312";"0.0312";"5";"N/A";"WOOD";"0";"1";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"163";"163";"BLOCK_PLATFORM_BIRCH";"0.0312";"0.0312";"0.0312";"0.0312";"5";"N/A";"WOOD";"0";"1";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"164";"164";"BLOCK_PLATFORM_BLOODROSE";"0.0312";"0.0312";"0.0312";"0.0312";"5";"N/A";"WOOD";"0";"1";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"176";"176";"BLOCK_TORCH";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"FXTR";"0";"0";"0";"N/A";"1";"0";"16";"1.0000";"0.6372";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"177";"177";"BLOCK_TORCH_FROST";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"FXTR";"0";"0";"0";"N/A";"1";"0";"16";"0.3048";"0.4848";"1.0000";"0.0000";"N/A";"N/A";"0.0" -"192";"176";"BLOCK_TORCH";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"FXTR";"0";"0";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"193";"177";"BLOCK_TORCH_FROST";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"FXTR";"0";"0";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"208";"208";"BLOCK_ILLUMINATOR_WHITE";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.9270";"0.9414";"0.8519";"0.0000";"N/A";"N/A";"0.0" -"209";"209";"BLOCK_ILLUMINATOR_YELLOW";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"1.0000";"0.8408";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"210";"210";"BLOCK_ILLUMINATOR_ORANGE";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"1.0000";"0.5294";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"211";"211";"BLOCK_ILLUMINATOR_RED";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.9188";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"212";"212";"BLOCK_ILLUMINATOR_FUCHSIA";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.9188";"0.0000";"0.7156";"0.0000";"N/A";"N/A";"0.0" -"213";"213";"BLOCK_ILLUMINATOR_PURPLE";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.7156";"0.0000";"0.9188";"0.0000";"N/A";"N/A";"0.0" -"214";"214";"BLOCK_ILLUMINATOR_BLUE";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.1996";"0.9188";"0.0000";"N/A";"N/A";"0.0" -"215";"215";"BLOCK_ILLUMINATOR_CYAN";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.4621";"1.4188";"1.2368";"0.0000";"N/A";"N/A";"0.0" -"216";"216";"BLOCK_ILLUMINATOR_GREEN";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.2112";"1.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"217";"217";"BLOCK_ILLUMINATOR_GREEN_DARK";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.1252";"0.4068";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"218";"218";"BLOCK_ILLUMINATOR_BROWN";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.3324";"0.1252";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"219";"219";"BLOCK_ILLUMINATOR_TAN";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.5864";"0.4068";"0.2032";"0.0000";"N/A";"N/A";"0.0" -"220";"220";"BLOCK_ILLUMINATOR_GREY_LIGHT";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.7392";"0.7392";"0.7392";"0.0000";"N/A";"N/A";"0.0" -"221";"221";"BLOCK_ILLUMINATOR_GREY_MED";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.4576";"0.4576";"0.4576";"0.0000";"N/A";"N/A";"0.0" -"222";"222";"BLOCK_ILLUMINATOR_GREY_DARK";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.2540";"0.2540";"0.2540";"0.0000";"N/A";"N/A";"0.0" -"223";"223";"BLOCK_ILLUMINATOR_BLACK";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.2140";"0.0000";"0.4932";"3.7499";"N/A";"N/A";"0.0" -"224";"208";"BLOCK_ILLUMINATOR_WHITE";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"225";"209";"BLOCK_ILLUMINATOR_YELLOW";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"226";"210";"BLOCK_ILLUMINATOR_ORANGE";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"227";"211";"BLOCK_ILLUMINATOR_RED";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"228";"212";"BLOCK_ILLUMINATOR_FUCHSIA";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"229";"213";"BLOCK_ILLUMINATOR_PURPLE";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"230";"214";"BLOCK_ILLUMINATOR_BLUE";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"231";"215";"BLOCK_ILLUMINATOR_CYAN";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"232";"216";"BLOCK_ILLUMINATOR_GREEN";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"233";"217";"BLOCK_ILLUMINATOR_GREEN_DARK";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"234";"218";"BLOCK_ILLUMINATOR_BROWN";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"235";"219";"BLOCK_ILLUMINATOR_TAN";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"236";"220";"BLOCK_ILLUMINATOR_GREY_LIGHT";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"237";"221";"BLOCK_ILLUMINATOR_GREY_MED";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"238";"222";"BLOCK_ILLUMINATOR_GREY_DARK";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"239";"223";"BLOCK_ILLUMINATOR_BLACK";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"160";"160";"BLOCK_PLATFORM_STONE";"0.0312";"0.0312";"0.0312";"0.0312";"5";"2400";"ROCK";"0";"1";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"161";"161";"BLOCK_PLATFORM_WOODEN";"0.0312";"0.0312";"0.0312";"0.0312";"5";"740";"WOOD";"0";"1";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"162";"162";"BLOCK_PLATFORM_EBONY";"0.0312";"0.0312";"0.0312";"0.0312";"5";"1200";"WOOD";"0";"1";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"163";"163";"BLOCK_PLATFORM_BIRCH";"0.0312";"0.0312";"0.0312";"0.0312";"5";"670";"WOOD";"0";"1";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"164";"164";"BLOCK_PLATFORM_BLOODROSE";"0.0312";"0.0312";"0.0312";"0.0312";"5";"900";"WOOD";"0";"1";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"176";"176";"BLOCK_TORCH";"0.0312";"0.0312";"0.0312";"0.0312";"1";"800";"FXTR";"0";"0";"0";"N/A";"1";"0";"16";"1.0000";"0.6372";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"177";"177";"BLOCK_TORCH_FROST";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1100";"FXTR";"0";"0";"0";"N/A";"1";"0";"16";"0.3048";"0.4848";"1.0000";"0.0000";"N/A";"N/A";"0.0" +"192";"176";"BLOCK_TORCH";"0.0312";"0.0312";"0.0312";"0.0312";"1";"800";"FXTR";"0";"0";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"193";"177";"BLOCK_TORCH_FROST";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1100";"FXTR";"0";"0";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"208";"208";"BLOCK_ILLUMINATOR_WHITE";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.9270";"0.9414";"0.8519";"0.0000";"N/A";"N/A";"0.0" +"209";"209";"BLOCK_ILLUMINATOR_YELLOW";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"1.0000";"0.8408";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"210";"210";"BLOCK_ILLUMINATOR_ORANGE";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"1.0000";"0.5294";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"211";"211";"BLOCK_ILLUMINATOR_RED";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.9188";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"212";"212";"BLOCK_ILLUMINATOR_FUCHSIA";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.9188";"0.0000";"0.7156";"0.0000";"N/A";"N/A";"0.0" +"213";"213";"BLOCK_ILLUMINATOR_PURPLE";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.7156";"0.0000";"0.9188";"0.0000";"N/A";"N/A";"0.0" +"214";"214";"BLOCK_ILLUMINATOR_BLUE";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.1996";"0.9188";"0.0000";"N/A";"N/A";"0.0" +"215";"215";"BLOCK_ILLUMINATOR_CYAN";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.4621";"1.4188";"1.2368";"0.0000";"N/A";"N/A";"0.0" +"216";"216";"BLOCK_ILLUMINATOR_GREEN";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.2112";"1.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"217";"217";"BLOCK_ILLUMINATOR_GREEN_DARK";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.1252";"0.4068";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"218";"218";"BLOCK_ILLUMINATOR_BROWN";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.3324";"0.1252";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"219";"219";"BLOCK_ILLUMINATOR_TAN";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.5864";"0.4068";"0.2032";"0.0000";"N/A";"N/A";"0.0" +"220";"220";"BLOCK_ILLUMINATOR_GREY_LIGHT";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.7392";"0.7392";"0.7392";"0.0000";"N/A";"N/A";"0.0" +"221";"221";"BLOCK_ILLUMINATOR_GREY_MED";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.4576";"0.4576";"0.4576";"0.0000";"N/A";"N/A";"0.0" +"222";"222";"BLOCK_ILLUMINATOR_GREY_DARK";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.2540";"0.2540";"0.2540";"0.0000";"N/A";"N/A";"0.0" +"223";"223";"BLOCK_ILLUMINATOR_BLACK";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.2140";"0.0000";"0.4932";"3.7499";"N/A";"N/A";"0.0" +"224";"208";"BLOCK_ILLUMINATOR_WHITE";"0.1252";"0.1252";"0.1252";"0.1252";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"225";"209";"BLOCK_ILLUMINATOR_YELLOW";"0.1252";"0.1252";"0.1252";"0.1252";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"226";"210";"BLOCK_ILLUMINATOR_ORANGE";"0.1252";"0.1252";"0.1252";"0.1252";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"227";"211";"BLOCK_ILLUMINATOR_RED";"0.1252";"0.1252";"0.1252";"0.1252";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"228";"212";"BLOCK_ILLUMINATOR_FUCHSIA";"0.1252";"0.1252";"0.1252";"0.1252";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"229";"213";"BLOCK_ILLUMINATOR_PURPLE";"0.1252";"0.1252";"0.1252";"0.1252";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"230";"214";"BLOCK_ILLUMINATOR_BLUE";"0.1252";"0.1252";"0.1252";"0.1252";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"231";"215";"BLOCK_ILLUMINATOR_CYAN";"0.1252";"0.1252";"0.1252";"0.1252";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"232";"216";"BLOCK_ILLUMINATOR_GREEN";"0.1252";"0.1252";"0.1252";"0.1252";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"233";"217";"BLOCK_ILLUMINATOR_GREEN_DARK";"0.1252";"0.1252";"0.1252";"0.1252";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"234";"218";"BLOCK_ILLUMINATOR_BROWN";"0.1252";"0.1252";"0.1252";"0.1252";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"235";"219";"BLOCK_ILLUMINATOR_TAN";"0.1252";"0.1252";"0.1252";"0.1252";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"236";"220";"BLOCK_ILLUMINATOR_GREY_LIGHT";"0.1252";"0.1252";"0.1252";"0.1252";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"237";"221";"BLOCK_ILLUMINATOR_GREY_MED";"0.1252";"0.1252";"0.1252";"0.1252";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"238";"222";"BLOCK_ILLUMINATOR_GREY_DARK";"0.1252";"0.1252";"0.1252";"0.1252";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"239";"223";"BLOCK_ILLUMINATOR_BLACK";"0.1252";"0.1252";"0.1252";"0.1252";"1";"2500";"GLAS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" "240";"240";"BLOCK_SANDSTONE";"0.1252";"0.1252";"0.1252";"0.1252";"48";"1900";"ROCK";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" "241";"241";"BLOCK_SANDSTONE_WHITE";"0.1252";"0.1252";"0.1252";"0.1252";"48";"1900";"ROCK";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" "242";"242";"BLOCK_SANDSTONE_RED";"0.1252";"0.1252";"0.1252";"0.1252";"48";"1900";"ROCK";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" "243";"243";"BLOCK_SANDSTONE_DESERT";"0.1252";"0.1252";"0.1252";"0.1252";"48";"1900";"ROCK";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" "244";"244";"BLOCK_SANDSTONE_BLACK";"0.1252";"0.1252";"0.1252";"0.1252";"48";"1900";"ROCK";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" "245";"245";"BLOCK_SANDSTONE_GREEN";"0.1252";"0.1252";"0.1252";"0.1252";"48";"1900";"ROCK";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"256";"256";"BLOCK_LANTERN";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"FXTR";"0";"0";"0";"N/A";"0";"0";"16";"1.0000";"0.6372";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"257";"257";"BLOCK_SUNSTONE";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"ROCK";"1";"0";"0";"N/A";"2";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"258";"258";"BLOCK_DAYLIGHT_CAPACITOR";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"GLAS";"1";"0";"0";"N/A";"3";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" -"272";"272";"BLOCK_SCAFFOLDING_NORMAL";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"WOOD";"0";"1";"0";"6";"0";"0";"16";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A";"0.0" -"273";"273";"BLOCK_SCAFFOLDING_EBONY";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"WOOD";"0";"1";"0";"6";"0";"0";"16";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A";"0.0" -"274";"274";"BLOCK_SCAFFOLDING_BIRCH";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"WOOD";"0";"1";"0";"6";"0";"0";"16";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A";"0.0" -"275";"275";"BLOCK_SCAFFOLDING_BLOODROSE";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"WOOD";"0";"1";"0";"6";"0";"0";"16";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A";"0.0" +"256";"256";"BLOCK_LANTERN";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1800";"FXTR";"0";"0";"0";"N/A";"0";"0";"16";"1.0000";"0.6372";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"257";"257";"BLOCK_SUNSTONE";"0.1252";"0.1252";"0.1252";"0.1252";"1";"2500";"ROCK";"1";"0";"0";"N/A";"2";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"258";"258";"BLOCK_DAYLIGHT_CAPACITOR";"0.1252";"0.1252";"0.1252";"0.1252";"1";"2500";"GLAS";"1";"0";"0";"N/A";"3";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0" +"272";"272";"BLOCK_SCAFFOLDING_NORMAL";"0.0312";"0.0312";"0.0312";"0.0312";"1";"740";"WOOD";"0";"1";"0";"6";"0";"0";"16";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A";"0.0" +"273";"273";"BLOCK_SCAFFOLDING_EBONY";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1400";"WOOD";"0";"1";"0";"6";"0";"0";"16";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A";"0.0" +"274";"274";"BLOCK_SCAFFOLDING_BIRCH";"0.0312";"0.0312";"0.0312";"0.0312";"1";"670";"WOOD";"0";"1";"0";"6";"0";"0";"16";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A";"0.0" +"275";"275";"BLOCK_SCAFFOLDING_BLOODROSE";"0.0312";"0.0312";"0.0312";"0.0312";"1";"900";"WOOD";"0";"1";"0";"6";"0";"0";"16";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A";"0.0" "4091";"0";"ACTORBLOCK_NO_COLLISION";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"NULL";"0";"0";"0";"N/A";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A";"0.0" "4092";"0";"ACTORBLOCK_FULL_COLLISION";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"NULL";"0";"0";"0";"N/A";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A";"0.0" "4093";"0";"ACTORBLOCK_ALLOW_MOVE_DOWN";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"NULL";"0";"1";"0";"N/A";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A";"0.0" diff --git a/src/net/torvald/terrarum/gameactors/ActorWithBody.kt b/src/net/torvald/terrarum/gameactors/ActorWithBody.kt index ada6b327e..4a2e5579a 100644 --- a/src/net/torvald/terrarum/gameactors/ActorWithBody.kt +++ b/src/net/torvald/terrarum/gameactors/ActorWithBody.kt @@ -49,7 +49,7 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties) /** This is GameWorld? only because the title screen also uses this thing as its camera; * titlescreen does not use instance of Ingame. */ - private val world: GameWorld? + protected val world: GameWorld? get() = Terrarum.ingame?.world diff --git a/src/net/torvald/terrarum/gameactors/WireActor.kt b/src/net/torvald/terrarum/gameactors/WireActor.kt index da94a117b..9b16813ab 100644 --- a/src/net/torvald/terrarum/gameactors/WireActor.kt +++ b/src/net/torvald/terrarum/gameactors/WireActor.kt @@ -33,8 +33,6 @@ class WireActor(id: ActorID) : ActorWithBody(RenderOrder.WIRES, PhysProperties.I private var worldX = 0 private var worldY = 0 - private val world: GameWorld - get() = Terrarum.ingame!!.world /** * @param itemID must start with "wire@" @@ -58,7 +56,7 @@ class WireActor(id: ActorID) : ActorWithBody(RenderOrder.WIRES, PhysProperties.I sprite!!.currentRow = 0 - val nearbyTiles = getNearbyTilesPos(worldX, worldY).map { world.getAllWiresFrom(it.x, it.y) } + val nearbyTiles = getNearbyTilesPos(worldX, worldY).map { world!!.getAllWiresFrom(it.x, it.y) } var ret = 0 for (i in 0..3) { if (nearbyTiles[i]?.contains(itemID) == true) { diff --git a/src/net/torvald/terrarum/gameworld/GameWorld.kt b/src/net/torvald/terrarum/gameworld/GameWorld.kt index f386d5ec6..6616d84a2 100644 --- a/src/net/torvald/terrarum/gameworld/GameWorld.kt +++ b/src/net/torvald/terrarum/gameworld/GameWorld.kt @@ -463,7 +463,7 @@ open class GameWorld : Disposable { /** * @return true if block is broken */ - fun inflictTerrainDamage(x: Int, y: Int, damage: Double): Boolean { + fun inflictTerrainDamage(x: Int, y: Int, damage: Double): ItemID? { val damage = damage.toFloat() val addr = LandUtil.getBlockAddr(this, x, y) @@ -483,12 +483,13 @@ open class GameWorld : Disposable { // remove tile from the world if (terrainDamages[addr] ?: 0f >= BlockCodex[getTileFromTerrain(x, y)].strength) { + val tileBroke = getTileFromTerrain(x, y) setTileTerrain(x, y, Block.AIR, false) terrainDamages.remove(addr) - return true + return tileBroke } - return false + return null } fun getTerrainDamage(x: Int, y: Int): Float = terrainDamages[LandUtil.getBlockAddr(this, x, y)] ?: 0f @@ -496,7 +497,7 @@ open class GameWorld : Disposable { /** * @return true if block is broken */ - fun inflictWallDamage(x: Int, y: Int, damage: Double): Boolean { + fun inflictWallDamage(x: Int, y: Int, damage: Double): ItemID? { val damage = damage.toFloat() val addr = LandUtil.getBlockAddr(this, x, y) @@ -512,12 +513,13 @@ open class GameWorld : Disposable { // remove tile from the world if (wallDamages[addr]!! >= BlockCodex[getTileFromWall(x, y)].strength) { + val tileBroke = getTileFromWall(x, y) setTileWall(x, y, Block.AIR, false) wallDamages.remove(addr) - return true + return tileBroke } - return false + return null } fun getWallDamage(x: Int, y: Int): Float = wallDamages[LandUtil.getBlockAddr(this, x, y)] ?: 0f diff --git a/src/net/torvald/terrarum/modulebasegame/BuildingMaker.kt b/src/net/torvald/terrarum/modulebasegame/BuildingMaker.kt index f731c79c7..992208919 100644 --- a/src/net/torvald/terrarum/modulebasegame/BuildingMaker.kt +++ b/src/net/torvald/terrarum/modulebasegame/BuildingMaker.kt @@ -176,7 +176,7 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) { } private fun drawSpriteInGoodPosition(sprite: TextureRegion, batch: SpriteBatch) { - val leftsidePadding = world.width.times(TILE_SIZE) - WorldCamera.width.ushr(1) + val leftsidePadding = world!!.width.times(TILE_SIZE) - WorldCamera.width.ushr(1) val rightsidePadding = WorldCamera.width.ushr(1) if (hitbox.startX in WorldCamera.x - hitbox.width..WorldCamera.x + WorldCamera.width.toDouble() && @@ -184,14 +184,14 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) { if (WorldCamera.xCentre > leftsidePadding && hitbox.centeredX <= rightsidePadding) { // camera center neg, actor center pos batch.draw(sprite, - hitbox.startX.toFloat() + world.width * TILE_SIZE, + hitbox.startX.toFloat() + world!!.width * TILE_SIZE, hitbox.startY.toFloat() ) } else if (WorldCamera.xCentre < rightsidePadding && hitbox.centeredY >= leftsidePadding) { // camera center pos, actor center neg batch.draw(sprite, - hitbox.startX.toFloat() - world.width * TILE_SIZE, + hitbox.startX.toFloat() - world!!.width * TILE_SIZE, hitbox.startY.toFloat() ) } diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt index a3af26e75..8c61e6737 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt @@ -34,9 +34,6 @@ open class ActorHumanoid( physProp: PhysProperties = PhysProperties.HUMANOID_DEFAULT ) : ActorWithBody(RenderOrder.MIDDLE, physProp = physProp), Controllable, Pocketed, Factionable, Luminous, LandHolder, HistoricalFigure { - private val world: GameWorld? - get() = Terrarum.ingame?.world - var vehicleRiding: Controllable? = null // usually player only diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/DroppedItem.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/DroppedItem.kt index 1a7285eca..bdde9807a 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/DroppedItem.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/DroppedItem.kt @@ -1,41 +1,93 @@ package net.torvald.terrarum.modulebasegame.gameactors import com.badlogic.gdx.graphics.g2d.SpriteBatch +import net.torvald.terrarum.AppLoader.printdbg +import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE +import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZEF import net.torvald.terrarum.blockproperties.BlockCodex import net.torvald.terrarum.gameactors.AVKey import net.torvald.terrarum.gameactors.ActorWithBody import net.torvald.terrarum.gameactors.PhysProperties import net.torvald.terrarum.gameitem.GameItem +import net.torvald.terrarum.gameitem.ItemID import net.torvald.terrarum.itemproperties.ItemCodex +import net.torvald.terrarum.worlddrawer.WorldCamera +import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack /** * Created by minjaesong on 2016-03-15. */ -open class DroppedItem(private val item: GameItem) : ActorWithBody(RenderOrder.MIDTOP, PhysProperties.PHYSICS_OBJECT) { +open class DroppedItem(private val itemID: ItemID, topLeftX: Int, topLeftY: Int) : ActorWithBody(RenderOrder.MIDTOP, PhysProperties.PHYSICS_OBJECT) { + + private val textureRegion = ItemCodex.getItemImage(itemID) init { - if (item.dynamicID.startsWith("actor@")) + if (itemID.startsWith("actor@")) throw RuntimeException("Attempted to create DroppedItem actor of a real actor; the real actor must be dropped instead.") isVisible = true - avBaseMass = if (item.dynamicID.startsWith("item@")) - ItemCodex[item.dynamicID]!!.mass + avBaseMass = if (itemID.startsWith("item@") || itemID.startsWith("wire@")) + (ItemCodex[itemID]?.mass ?: 2.0).coerceAtMost(2.0) else - BlockCodex[item.dynamicID].density / 1000.0 // block and wall + BlockCodex[itemID].density / 1000.0 // block and wall - actorValue[AVKey.SCALE] = ItemCodex[item.dynamicID]!!.scale + actorValue[AVKey.SCALE] = ItemCodex[itemID]?.scale ?: 1.0 + + setHitboxDimension( + textureRegion?.regionWidth ?: TILE_SIZE, + textureRegion?.regionHeight ?: TILE_SIZE, + 0, 0 + ) + + setPosition(topLeftX + (hitbox.width / 2.0), topLeftY + hitbox.height) + + + printdbg(this, "New dropped item $itemID") + } + + override fun drawBody(batch: SpriteBatch) { + // copy-pasted from ActorWithBody.drawSpriteInGoodPosition() + + if (world == null) return + + + val leftsidePadding = world!!.width.times(TILE_SIZE) - WorldCamera.width.ushr(1) + val rightsidePadding = WorldCamera.width.ushr(1) + + val offsetX = hitboxTranslateX * scale + val offsetY = (textureRegion?.regionHeight ?: TILE_SIZE) * scale - hitbox.height - hitboxTranslateY * scale - 1 + + textureRegion?.let { + // FIXME test me: this extra IF statement is supposed to not draw actors that's outside of the camera. + // basic code without offsetX/Y DOES work, but obviously offsets are not tested. + if (WorldCamera.xCentre > leftsidePadding && centrePosPoint.x <= rightsidePadding) { + // camera center neg, actor center pos + batch.draw(it, + (hitbox.startX - offsetX).toFloat() + world!!.width * TILE_SIZE, + (hitbox.startY - offsetY).toFloat(), + TILE_SIZEF * scale.toFloat(), TILE_SIZEF * scale.toFloat() + ) + } + else if (WorldCamera.xCentre < rightsidePadding && centrePosPoint.x >= leftsidePadding) { + // camera center pos, actor center neg + batch.draw(it, + (hitbox.startX - offsetX).toFloat() - world!!.width * TILE_SIZE, + (hitbox.startY - offsetY).toFloat(), + TILE_SIZEF * scale.toFloat(), TILE_SIZEF * scale.toFloat() + ) + } + else { + batch.draw(it, + (hitbox.startX - offsetX).toFloat(), + (hitbox.startY - offsetY).toFloat(), + TILE_SIZEF * scale.toFloat(), TILE_SIZEF * scale.toFloat() + ) + } + } } override fun update(delta: Float) { super.update(delta) } - - override fun drawGlow(batch: SpriteBatch) { - super.drawGlow(batch) - } - - override fun drawBody(batch: SpriteBatch) { - super.drawBody(batch) - } } \ No newline at end of file diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureBase.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureBase.kt index f7afcd3e4..e938f6aea 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureBase.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureBase.kt @@ -29,8 +29,6 @@ open class FixtureBase( var blockBox: BlockBox = blockBox0 protected set // something like TapestryObject will want to redefine this - private val world: GameWorld - get() = Terrarum.ingame!!.world /** * Block-wise position of this fixture when it's placed on the world. Null if it's not on the world @@ -66,7 +64,7 @@ open class FixtureBase( checkForCollision@ for (y in posY until posY + blockBox.height) { for (x in posX until posX + blockBox.width) { - val tile = world.getTileFromTerrain(x, y) + val tile = world!!.getTileFromTerrain(x, y) if (BlockCodex[tile].isSolid || tile in Block.actorblocks) { hasCollision = true break@checkForCollision @@ -84,10 +82,10 @@ open class FixtureBase( // if the collision type is allow_move_down, only the top surface tile should be "the platform" // lower part must not have such property (think of the table!) // TODO does this ACTUALLY work ?! - world.setTileTerrain(x, y, if (y == posY) BlockBox.ALLOW_MOVE_DOWN else BlockBox.NO_COLLISION, false) + world!!.setTileTerrain(x, y, if (y == posY) BlockBox.ALLOW_MOVE_DOWN else BlockBox.NO_COLLISION, false) } else - world.setTileTerrain(x, y, blockBox.collisionType, false) + world!!.setTileTerrain(x, y, blockBox.collisionType, false) } } @@ -122,7 +120,7 @@ open class FixtureBase( // remove filler block for (x in posX until posX + blockBox.width) { for (y in posY until posY + blockBox.height) { - world.setTileTerrain(x, y, Block.AIR, false) + world!!.setTileTerrain(x, y, Block.AIR, false) } } @@ -152,7 +150,7 @@ open class FixtureBase( outerLoop@ for (x in posX until posX + blockBox.width) { for (y in posY until posY + blockBox.height) { - if (world.getTileFromTerrain(x, y) != blockBox.collisionType) { + if (world!!.getTileFromTerrain(x, y) != blockBox.collisionType) { dropThis = true break@outerLoop } @@ -163,8 +161,8 @@ open class FixtureBase( // fill blockbox with air for (x in posX until posX + blockBox.width) { for (y in posY until posY + blockBox.height) { - if (world.getTileFromTerrain(x, y) == blockBox.collisionType) { - world.setTileTerrain(x, y, Block.AIR, false) + if (world!!.getTileFromTerrain(x, y) == blockBox.collisionType) { + world!!.setTileTerrain(x, y, Block.AIR, false) } } } diff --git a/src/net/torvald/terrarum/modulebasegame/gameitems/PickaxeGeneric.kt b/src/net/torvald/terrarum/modulebasegame/gameitems/PickaxeGeneric.kt index c62598433..32d1713f6 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameitems/PickaxeGeneric.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameitems/PickaxeGeneric.kt @@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion import net.torvald.terrarum.CommonResourcePool import net.torvald.terrarum.Point2d import net.torvald.terrarum.Terrarum +import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE import net.torvald.terrarum.blockproperties.Block import net.torvald.terrarum.gameactors.AVKey import net.torvald.terrarum.gameitem.GameItem @@ -11,6 +12,7 @@ import net.torvald.terrarum.gameitem.ItemID import net.torvald.terrarum.itemproperties.Calculate import net.torvald.terrarum.itemproperties.MaterialCodex import net.torvald.terrarum.modulebasegame.TerrarumIngame +import net.torvald.terrarum.modulebasegame.gameactors.DroppedItem import net.torvald.terrarum.modulebasegame.gameitems.PickaxeCore.BASE_MASS_AND_SIZE import net.torvald.terrarum.modulebasegame.gameitems.PickaxeCore.TOOL_DURABILITY_BASE import kotlin.math.roundToInt @@ -20,8 +22,7 @@ import kotlin.math.roundToInt */ object PickaxeCore { fun startPrimaryUse(delta: Float, item: GameItem): Boolean { - val player = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying - if (player == null) return false + val player = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying ?: return false val mouseTileX = Terrarum.mouseTileX val mouseTileY = Terrarum.mouseTileY @@ -51,7 +52,9 @@ object PickaxeCore { (Terrarum.ingame!!.world).inflictTerrainDamage( mouseTileX, mouseTileY, Calculate.pickaxePower(player, item.material) * swingDmgToFrameDmg - ) + )?.let { tileBroken -> + Terrarum.ingame!!.addNewActor(DroppedItem(tileBroken, mouseTileX * TILE_SIZE, mouseTileY * TILE_SIZE)) + } return true }