mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-01-08 01:49:35 +01:00
Added interaction range check.
This commit is contained in:
parent
fd42c5e8e6
commit
6c7f8625b5
@ -24,12 +24,17 @@ class_name EntityDataGD
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
const INTERACT_RANGE_SQUARED : int = 4 * 4
|
||||
|
||||
func _sinteract(entity: Entity) -> void:
|
||||
var target : Entity = entity.gets_target()
|
||||
|
||||
if target == null or not is_instance_valid(target):
|
||||
return
|
||||
|
||||
if (entity.get_body_3d().translation - target.get_body_3d().translation).length_squared() > INTERACT_RANGE_SQUARED:
|
||||
return
|
||||
|
||||
if target.sentity_interaction_type == EntityEnums.ENITIY_INTERACTION_TYPE_LOOT:
|
||||
if target.gets_entity_data().loot_db != null and target.sbag == null:
|
||||
var ldb : LootDataBase = target.gets_entity_data().loot_db
|
||||
|
Loading…
Reference in New Issue
Block a user