mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-02-20 17:14:44 +01:00
Added a simple Speed and Health resource.
This commit is contained in:
parent
2c47f9f550
commit
bebab39f34
4
SCsub
4
SCsub
@ -81,7 +81,11 @@ sources = [
|
||||
|
||||
"entities/resources/entity_resource_data.cpp",
|
||||
"entities/resources/entity_resource_cost_data.cpp",
|
||||
"entities/resources/entity_resource_cost_data_health.cpp",
|
||||
"entities/resources/entity_resource_cost_data_resource.cpp",
|
||||
"entities/resources/entity_resource.cpp",
|
||||
"entities/resources/entity_resource_health.cpp",
|
||||
"entities/resources/entity_resource_speed.cpp",
|
||||
|
||||
"drag_and_drop/es_drag_and_drop.cpp",
|
||||
|
||||
|
@ -49,8 +49,12 @@ def get_doc_classes():
|
||||
"VendorItemDataEntry",
|
||||
"VendorItemData",
|
||||
"EntityResourceCostData",
|
||||
"EntityResourceCostDataHealth",
|
||||
"EntityResourceCostDataResource",
|
||||
"EntityResourceData",
|
||||
"EntityResource",
|
||||
"EntityResourceHealth",
|
||||
"EntityResourceSpeed",
|
||||
"EntitySkillData",
|
||||
"EntitySkill",
|
||||
"ComplexLevelStatData",
|
||||
|
@ -398,8 +398,6 @@ public:
|
||||
void resource_removes(int index);
|
||||
void resource_clears();
|
||||
|
||||
void resource_addc_rpc(int index, String data);
|
||||
|
||||
Ref<EntityResource> resource_getc_index(int index);
|
||||
Ref<EntityResource> resource_getc_id(int id);
|
||||
void resource_addc(int index, Ref<EntityResource> resource);
|
||||
@ -407,6 +405,8 @@ public:
|
||||
void resource_removec(int index);
|
||||
void resource_clearc();
|
||||
|
||||
void resource_addc_rpc(int index, String data);
|
||||
|
||||
void resource_sends_current(int index, int current);
|
||||
void resource_sends_curr_max(int index, int current, int max);
|
||||
void resource_sends_data(int index, String data);
|
||||
|
@ -22,13 +22,6 @@ SOFTWARE.
|
||||
|
||||
#include "entity_resource_cost_data.h"
|
||||
|
||||
Ref<EntityResourceData> EntityResourceCostData::get_entity_resource_data() {
|
||||
return _entity_resource_data;
|
||||
}
|
||||
void EntityResourceCostData::set_entity_resource_data(Ref<EntityResourceData> data) {
|
||||
_entity_resource_data = data;
|
||||
}
|
||||
|
||||
int EntityResourceCostData::get_cost() {
|
||||
return _cost;
|
||||
}
|
||||
@ -41,10 +34,6 @@ EntityResourceCostData::EntityResourceCostData() {
|
||||
}
|
||||
|
||||
void EntityResourceCostData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_entity_resource_data"), &EntityResourceCostData::get_entity_resource_data);
|
||||
ClassDB::bind_method(D_METHOD("set_entity_resource_data", "value"), &EntityResourceCostData::set_entity_resource_data);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "entity_resource_data", PROPERTY_HINT_RESOURCE_TYPE, "EntityResourceData"), "set_entity_resource_data", "get_entity_resource_data");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_cost"), &EntityResourceCostData::get_cost);
|
||||
ClassDB::bind_method(D_METHOD("set_cost", "value"), &EntityResourceCostData::set_cost);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "cost"), "set_cost", "get_cost");
|
||||
|
@ -32,9 +32,6 @@ class EntityResourceCostData : public Resource {
|
||||
GDCLASS(EntityResourceCostData, Resource);
|
||||
|
||||
public:
|
||||
Ref<EntityResourceData> get_entity_resource_data();
|
||||
void set_entity_resource_data(Ref<EntityResourceData> data);
|
||||
|
||||
int get_cost();
|
||||
void set_cost(int value);
|
||||
|
||||
@ -44,7 +41,6 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
Ref<EntityResourceData> _entity_resource_data;
|
||||
int _cost;
|
||||
};
|
||||
|
||||
|
29
entities/resources/entity_resource_cost_data_health.cpp
Normal file
29
entities/resources/entity_resource_cost_data_health.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright (c) 2019-2020 Péter Magyar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "entity_resource_cost_data_health.h"
|
||||
|
||||
EntityResourceCostDataHealth::EntityResourceCostDataHealth() {
|
||||
}
|
||||
|
||||
void EntityResourceCostDataHealth::_bind_methods() {
|
||||
}
|
41
entities/resources/entity_resource_cost_data_health.h
Normal file
41
entities/resources/entity_resource_cost_data_health.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright (c) 2019-2020 Péter Magyar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ENTITY_RESOURCE_COST_DATA_HEALTH_H
|
||||
#define ENTITY_RESOURCE_COST_DATA_HEALTH_H
|
||||
|
||||
#include "core/resource.h"
|
||||
|
||||
#include "entity_resource_cost_data.h"
|
||||
#include "entity_resource_data.h"
|
||||
|
||||
class EntityResourceCostDataHealth : public EntityResourceCostData {
|
||||
GDCLASS(EntityResourceCostDataHealth, EntityResourceCostData);
|
||||
|
||||
public:
|
||||
EntityResourceCostDataHealth();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
};
|
||||
|
||||
#endif
|
39
entities/resources/entity_resource_cost_data_resource.cpp
Normal file
39
entities/resources/entity_resource_cost_data_resource.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright (c) 2019-2020 Péter Magyar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "entity_resource_cost_data_resource.h"
|
||||
|
||||
Ref<EntityResourceData> EntityResourceCostDataResource::get_entity_resource_data() {
|
||||
return _entity_resource_data;
|
||||
}
|
||||
void EntityResourceCostDataResource::set_entity_resource_data(Ref<EntityResourceData> data) {
|
||||
_entity_resource_data = data;
|
||||
}
|
||||
|
||||
EntityResourceCostDataResource::EntityResourceCostDataResource() {
|
||||
}
|
||||
|
||||
void EntityResourceCostDataResource::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_entity_resource_data"), &EntityResourceCostDataResource::get_entity_resource_data);
|
||||
ClassDB::bind_method(D_METHOD("set_entity_resource_data", "value"), &EntityResourceCostDataResource::set_entity_resource_data);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "entity_resource_data", PROPERTY_HINT_RESOURCE_TYPE, "EntityResourceData"), "set_entity_resource_data", "get_entity_resource_data");
|
||||
}
|
47
entities/resources/entity_resource_cost_data_resource.h
Normal file
47
entities/resources/entity_resource_cost_data_resource.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
Copyright (c) 2019-2020 Péter Magyar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ENTITY_RESOURCE_COST_DATA_RESOURCE_H
|
||||
#define ENTITY_RESOURCE_COST_DATA_RESOURCE_H
|
||||
|
||||
#include "core/resource.h"
|
||||
|
||||
#include "entity_resource_cost_data.h"
|
||||
#include "entity_resource_data.h"
|
||||
|
||||
class EntityResourceCostDataResource : public EntityResourceCostData {
|
||||
GDCLASS(EntityResourceCostDataResource, EntityResourceCostData);
|
||||
|
||||
public:
|
||||
Ref<EntityResourceData> get_entity_resource_data();
|
||||
void set_entity_resource_data(Ref<EntityResourceData> data);
|
||||
|
||||
EntityResourceCostDataResource();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
Ref<EntityResourceData> _entity_resource_data;
|
||||
};
|
||||
|
||||
#endif
|
74
entities/resources/entity_resource_health.cpp
Normal file
74
entities/resources/entity_resource_health.cpp
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
Copyright (c) 2019-2020 Péter Magyar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "entity_resource_health.h"
|
||||
|
||||
#include "../../database/ess_resource_db.h"
|
||||
#include "../../singletons/ess.h"
|
||||
#include "../entity.h"
|
||||
#include "../stats/stat.h"
|
||||
#include "entity_resource_data.h"
|
||||
|
||||
void EntityResourceHealth::_init() {
|
||||
set_current_value(100);
|
||||
stamina_stat_id = 0;
|
||||
health_stat_id = 0;
|
||||
|
||||
if (ESS::get_instance()->stat_is_property("Stamina")) {
|
||||
stamina_stat_id = ESS::get_instance()->stat_get_id("Stamina");
|
||||
}
|
||||
|
||||
if (ESS::get_instance()->stat_is_property("Health")) {
|
||||
health_stat_id = ESS::get_instance()->stat_get_id("Health");
|
||||
}
|
||||
}
|
||||
void EntityResourceHealth::_ons_added(Node *entity) {
|
||||
refresh();
|
||||
}
|
||||
void EntityResourceHealth::_notification_sstat_changed(Ref<Stat> stat) {
|
||||
if (stat->get_id() == stamina_stat_id || stat->get_id() == health_stat_id)
|
||||
refresh();
|
||||
}
|
||||
void EntityResourceHealth::refresh() {
|
||||
Ref<Stat> stamina = get_owner()->get_stat(stamina_stat_id);
|
||||
Ref<Stat> health = get_owner()->get_stat(health_stat_id);
|
||||
|
||||
int val = int(stamina->gets_current()) * 10 + int(health->gets_current());
|
||||
|
||||
set_max_value(val);
|
||||
set_current_value(val);
|
||||
}
|
||||
|
||||
EntityResourceHealth::EntityResourceHealth() {
|
||||
stamina_stat_id = 0;
|
||||
health_stat_id = 0;
|
||||
}
|
||||
|
||||
EntityResourceHealth::~EntityResourceHealth() {
|
||||
}
|
||||
|
||||
void EntityResourceHealth::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("_init"), &EntityResourceHealth::_init);
|
||||
ClassDB::bind_method(D_METHOD("_ons_added", "entity"), &EntityResourceHealth::_ons_added);
|
||||
ClassDB::bind_method(D_METHOD("_notification_sstat_changed", "stat"), &EntityResourceHealth::_notification_sstat_changed);
|
||||
ClassDB::bind_method(D_METHOD("refresh"), &EntityResourceHealth::refresh);
|
||||
}
|
52
entities/resources/entity_resource_health.h
Normal file
52
entities/resources/entity_resource_health.h
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
Copyright (c) 2019-2020 Péter Magyar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ENTITY_RESOURCE_HEALTH_H
|
||||
#define ENTITY_RESOURCE_HEALTH_H
|
||||
|
||||
#include "entity_resource.h"
|
||||
|
||||
class Stat;
|
||||
class Entity;
|
||||
class EntityResourceData;
|
||||
|
||||
class EntityResourceHealth : public EntityResource {
|
||||
GDCLASS(EntityResourceHealth, EntityResource);
|
||||
|
||||
public:
|
||||
void _init();
|
||||
void _ons_added(Node *entity);
|
||||
void _notification_sstat_changed(Ref<Stat> stat);
|
||||
void refresh();
|
||||
|
||||
EntityResourceHealth();
|
||||
~EntityResourceHealth();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
int stamina_stat_id;
|
||||
int health_stat_id;
|
||||
};
|
||||
|
||||
#endif
|
66
entities/resources/entity_resource_speed.cpp
Normal file
66
entities/resources/entity_resource_speed.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
Copyright (c) 2019-2020 Péter Magyar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "entity_resource_speed.h"
|
||||
|
||||
#include "../../database/ess_resource_db.h"
|
||||
#include "../../singletons/ess.h"
|
||||
#include "../entity.h"
|
||||
#include "../stats/stat.h"
|
||||
#include "entity_resource_data.h"
|
||||
|
||||
void EntityResourceSpeed::_init() {
|
||||
set_current_value(base_value);
|
||||
|
||||
speed_stat_id = 0;
|
||||
|
||||
if (ESS::get_instance()->stat_is_property("Speed"))
|
||||
speed_stat_id = ESS::get_instance()->stat_get_id("Speed");
|
||||
}
|
||||
void EntityResourceSpeed::_ons_added(Node *entity) {
|
||||
refresh();
|
||||
}
|
||||
void EntityResourceSpeed::_notification_sstat_changed(Ref<Stat> stat) {
|
||||
if (stat->get_id() == speed_stat_id)
|
||||
refresh();
|
||||
}
|
||||
void EntityResourceSpeed::refresh() {
|
||||
Ref<Stat> speed_stat = get_owner()->get_stat(speed_stat_id);
|
||||
|
||||
set_max_value(base_value + speed_stat->gets_current() * 0.01);
|
||||
set_current_value(base_value + speed_stat->gets_current() * 0.01);
|
||||
}
|
||||
|
||||
EntityResourceSpeed::EntityResourceSpeed() {
|
||||
speed_stat_id = 0;
|
||||
base_value = 100;
|
||||
}
|
||||
|
||||
EntityResourceSpeed::~EntityResourceSpeed() {
|
||||
}
|
||||
|
||||
void EntityResourceSpeed::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("_init"), &EntityResourceSpeed::_init);
|
||||
ClassDB::bind_method(D_METHOD("_ons_added", "entity"), &EntityResourceSpeed::_ons_added);
|
||||
ClassDB::bind_method(D_METHOD("_notification_sstat_changed", "stat"), &EntityResourceSpeed::_notification_sstat_changed);
|
||||
ClassDB::bind_method(D_METHOD("refresh"), &EntityResourceSpeed::refresh);
|
||||
}
|
52
entities/resources/entity_resource_speed.h
Normal file
52
entities/resources/entity_resource_speed.h
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
Copyright (c) 2019-2020 Péter Magyar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ENTITY_RESOURCE_SPEED_H
|
||||
#define ENTITY_RESOURCE_SPEED_H
|
||||
|
||||
#include "entity_resource.h"
|
||||
|
||||
class Stat;
|
||||
class Entity;
|
||||
class EntityResourceData;
|
||||
|
||||
class EntityResourceSpeed : public EntityResource {
|
||||
GDCLASS(EntityResourceSpeed, EntityResource);
|
||||
|
||||
public:
|
||||
void _init();
|
||||
void _ons_added(Node *entity);
|
||||
void _notification_sstat_changed(Ref<Stat> stat);
|
||||
void refresh();
|
||||
|
||||
EntityResourceSpeed();
|
||||
~EntityResourceSpeed();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
int speed_stat_id;
|
||||
int base_value;
|
||||
};
|
||||
|
||||
#endif
|
@ -86,7 +86,11 @@ SOFTWARE.
|
||||
|
||||
#include "entities/resources/entity_resource.h"
|
||||
#include "entities/resources/entity_resource_cost_data.h"
|
||||
#include "entities/resources/entity_resource_cost_data_health.h"
|
||||
#include "entities/resources/entity_resource_cost_data_resource.h"
|
||||
#include "entities/resources/entity_resource_data.h"
|
||||
#include "entities/resources/entity_resource_health.h"
|
||||
#include "entities/resources/entity_resource_speed.h"
|
||||
|
||||
#include "entities/auras/aura_data.h"
|
||||
#include "entities/entity.h"
|
||||
@ -212,7 +216,11 @@ void register_entity_spell_system_types() {
|
||||
|
||||
ClassDB::register_class<EntityResourceData>();
|
||||
ClassDB::register_class<EntityResourceCostData>();
|
||||
ClassDB::register_class<EntityResourceCostDataHealth>();
|
||||
ClassDB::register_class<EntityResourceCostDataResource>();
|
||||
ClassDB::register_class<EntityResource>();
|
||||
ClassDB::register_class<EntityResourceHealth>();
|
||||
ClassDB::register_class<EntityResourceSpeed>();
|
||||
|
||||
ClassDB::register_class<AuraTriggerData>();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user