CommitLog |
This commit is contained in:
parent
a5240df77c
commit
bd80cf385a
4 changed files with 166 additions and 269 deletions
|
@ -80,19 +80,51 @@ for(var xx = 0; xx < CHUNK_SIZE*TILE_SIZE; xx+= TILE_SIZE)
|
|||
<arguments>
|
||||
<argument>
|
||||
<kind>1</kind>
|
||||
<string>var chunk_total_size = CHUNK_SIZE * TILE_SIZE
|
||||
|
||||
|
||||
if(distance_to_object(obj_player) > chunk_total_size*3)
|
||||
<string>///Place blocks
|
||||
if(mouse_check_button_pressed(mb_right) || gamepad_button_check_pressed(0,gp_shoulderl))
|
||||
{
|
||||
event_user(0);
|
||||
if(obj_inv_controller.is_open)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
var selected_item = obj_inv_controller.inventory[obj_hotbar.selected_slot];
|
||||
|
||||
if(selected_item != 0)
|
||||
{
|
||||
var selX = round(mouse_x/TILE_SIZE)*TILE_SIZE;
|
||||
var selY = round(mouse_y/TILE_SIZE)*TILE_SIZE;
|
||||
selX -= TILE_SIZE / 2;
|
||||
selY -= TILE_SIZE / 2;
|
||||
|
||||
var objid = instance_position(selX,selY,obj_placed_item)
|
||||
if(objid != noone)
|
||||
{
|
||||
show_debug_message(string(objid)+", "+string(objid.object_index));
|
||||
return 0;
|
||||
}
|
||||
|
||||
objid = instance_position(selX,selY,obj_player)
|
||||
if(objid != noone)
|
||||
{
|
||||
show_debug_message(string(objid)+", "+string(objid.object_index));
|
||||
return 0;
|
||||
}
|
||||
|
||||
var inst = instance_create(selX,selY,obj_placed_item);
|
||||
use_item_in_inventory(obj_hotbar.selected_slot);
|
||||
var chunkid = id;
|
||||
with(inst){
|
||||
inst.ITEM_ID = selected_item;
|
||||
inst.CHUNK_CONTAINED = chunkid;
|
||||
}
|
||||
ds_list_add(instance_list, inst);
|
||||
}
|
||||
}
|
||||
</string>
|
||||
</argument>
|
||||
</arguments>
|
||||
</action>
|
||||
</event>
|
||||
<event eventtype="6" enumb="5">
|
||||
<action>
|
||||
<libid>1</libid>
|
||||
<id>603</id>
|
||||
|
@ -109,43 +141,12 @@ if(distance_to_object(obj_player) > chunk_total_size*3)
|
|||
<arguments>
|
||||
<argument>
|
||||
<kind>1</kind>
|
||||
<string>///Place items
|
||||
if(obj_inv_controller.is_open)
|
||||
<string>var chunk_total_size = CHUNK_SIZE * TILE_SIZE
|
||||
|
||||
|
||||
if(distance_to_object(obj_player) > chunk_total_size*3)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
var selected_item = obj_inv_controller.inventory[obj_hotbar.selected_slot];
|
||||
|
||||
if(selected_item != 0)
|
||||
{
|
||||
var selX = round(mouse_x/TILE_SIZE)*TILE_SIZE;
|
||||
var selY = round(mouse_y/TILE_SIZE)*TILE_SIZE;
|
||||
selX -= TILE_SIZE / 2;
|
||||
selY -= TILE_SIZE / 2;
|
||||
|
||||
var objid = instance_position(selX,selY,obj_placed_item)
|
||||
if(objid != noone)
|
||||
{
|
||||
show_debug_message(string(objid)+", "+string(objid.object_index));
|
||||
return 0;
|
||||
}
|
||||
|
||||
objid = instance_position(selX,selY,obj_player)
|
||||
if(objid != noone)
|
||||
{
|
||||
show_debug_message(string(objid)+", "+string(objid.object_index));
|
||||
return 0;
|
||||
}
|
||||
|
||||
var inst = instance_create(selX,selY,obj_placed_item);
|
||||
use_item_in_inventory(obj_hotbar.selected_slot);
|
||||
var chunkid = id;
|
||||
with(inst){
|
||||
inst.ITEM_ID = selected_item;
|
||||
inst.CHUNK_CONTAINED = chunkid;
|
||||
}
|
||||
ds_list_add(instance_list, inst);
|
||||
event_user(0);
|
||||
}
|
||||
</string>
|
||||
</argument>
|
||||
|
|
Reference in a new issue