z_mirror/MouseOverConstruction
git clone https://git.raiguard.me/z_mirror/MouseOverConstruction
7c145b8
trunk
1local common =require ( "scripts.common" ) 2 3--- @param player LuaPlayer 4--- @param entity LuaEntity 5--- @return boolean 6return function ( player , entity ) 7if not entity . valid then 8return false 9end 10 11if not player . mod_settings [ "moc-enable-construction" ]. value then 12return false 13end 14 15if entity . type ~= "entity-ghost" then 16return false 17end 18 19local entity_prototype =entity . ghost_prototype --[[@as LuaEntityPrototype]] 20 21if not common . check_can_place_entity ( player , entity , entity_prototype ) then 22return false 23end 24 25local new_entity =common . build ( player , entity , entity_prototype , entity . quality ) 26 27return new_entity and new_entity . valid and true or false 28end