-
Notifications
You must be signed in to change notification settings - Fork 565
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert remaining entities to use entity definition macros
- Loading branch information
1 parent
402d83c
commit d704403
Showing
16 changed files
with
138 additions
and
374 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,24 @@ | ||
/datum/entity/chemical_information | ||
var/nutriment_factor | ||
var/custom_metabolism | ||
var/overdose | ||
var/overdose_critical | ||
var/color | ||
var/explosive | ||
var/power | ||
var/falloff_modifier | ||
var/chemfiresupp | ||
var/intensitymod | ||
var/durationmod | ||
var/radiusmod | ||
var/burncolor | ||
var/burncolormod | ||
var/properties_text | ||
var/spent_chemical | ||
|
||
DEFINE_ENTITY(chemical_information, "chemical_information") | ||
var/list/properties | ||
FIELD_STRING_SMALL(chemical_information, color) | ||
FIELD_INT(chemical_information, explosive) | ||
FIELD_DECIMAL(chemical_information, power) | ||
FIELD_DECIMAL(chemical_information, falloff_modifier) | ||
FIELD_INT(chemical_information, chemfiresupp) | ||
FIELD_DECIMAL(chemical_information, intensitymod) | ||
FIELD_DECIMAL(chemical_information, durationmod) | ||
FIELD_DECIMAL(chemical_information, radiusmod) | ||
FIELD_STRING_SMALL(chemical_information, burncolor) | ||
FIELD_INT(chemical_information, burncolormod) | ||
FIELD_STRING_MAX(chemical_information, properties_text) | ||
FIELD_INT(chemical_information, spent_chemical) | ||
|
||
/datum/entity_meta/chemical_information | ||
entity_type = /datum/entity/chemical_information | ||
table_name = "chemical_information" | ||
field_typepaths = list( | ||
"nutriment_factor" = DB_FIELDTYPE_DECIMAL, | ||
"custom_metabolism" = DB_FIELDTYPE_DECIMAL, | ||
"overdose" = DB_FIELDTYPE_INT, | ||
"overdose_critical" = DB_FIELDTYPE_INT, | ||
"color" = DB_FIELDTYPE_STRING_SMALL, | ||
"explosive" = DB_FIELDTYPE_INT, | ||
"power" = DB_FIELDTYPE_DECIMAL, | ||
"falloff_modifier" = DB_FIELDTYPE_DECIMAL, | ||
"chemfiresupp" = DB_FIELDTYPE_INT, | ||
"intensitymod" = DB_FIELDTYPE_DECIMAL, | ||
"durationmod" = DB_FIELDTYPE_DECIMAL, | ||
"radiusmod" = DB_FIELDTYPE_DECIMAL, | ||
"burncolor" = DB_FIELDTYPE_STRING_SMALL, | ||
"burncolormod" = DB_FIELDTYPE_INT, | ||
"properties_text" = DB_FIELDTYPE_STRING_MAX, | ||
"spent_chemical" = DB_FIELDTYPE_INT, | ||
) | ||
|
||
/datum/entity_meta/chemical_information/map(datum/entity/chemical_information/ET, list/values) | ||
/datum/entity_meta/chemical_information/map(datum/entity/chemical_information/entity, list/values) | ||
..() | ||
if(values["properties_text"]) | ||
ET.properties = json_decode(values["properties_text"]) | ||
entity.properties = json_decode(values["properties_text"]) | ||
|
||
/datum/entity_meta/chemical_information/unmap(datum/entity/chemical_information/ET) | ||
/datum/entity_meta/chemical_information/unmap(datum/entity/chemical_information/entity) | ||
. = ..() | ||
if(length(ET.properties)) | ||
.["properties_text"] = json_encode(ET.properties) | ||
if(length(entity.properties)) | ||
.["properties_text"] = json_encode(entity.properties) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,7 @@ | ||
/datum/entity/map_vote | ||
var/map_name | ||
var/total_votes | ||
|
||
|
||
/datum/entity_meta/map_vote | ||
entity_type = /datum/entity/map_vote | ||
table_name = "map_vote" | ||
field_typepaths = list( | ||
"map_name"=DB_FIELDTYPE_STRING_LARGE, | ||
"total_votes"=DB_FIELDTYPE_BIGINT, | ||
) | ||
DEFINE_ENTITY(map_vote, "map_vote") | ||
FIELD_STRING_LARGE(map_vote, map_name) | ||
FIELD_BIGINT(map_vote, total_votes) | ||
|
||
// TODO: have this handled automatically by virtue of type (deserialization) | ||
/datum/entity_meta/map_vote/on_read(datum/entity/map_vote/vote) | ||
vote.total_votes = text2num("[vote.total_votes]") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,4 @@ | ||
/datum/entity/mc_controller | ||
var/controller_type | ||
var/wait_time | ||
|
||
/datum/entity_meta/mc_controller | ||
entity_type = /datum/entity/mc_controller | ||
table_name = "mc_controller" | ||
key_field = "controller_type" | ||
field_typepaths = list( | ||
"controller_type"=DB_FIELDTYPE_STRING_LARGE, | ||
"wait_time"=DB_FIELDTYPE_INT, | ||
) | ||
DEFINE_ENTITY(mc_controller, "mc_controller") | ||
FIELD_STRING_LARGE(mc_controller, controller_type) | ||
FIELD_INT(mc_controller, wait_time) | ||
KEY_FIELD(mc_controller, controller_type) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,5 @@ | ||
/datum/entity/mc_record | ||
var/round_time | ||
var/round_id | ||
var/controller_id | ||
var/time_taken | ||
|
||
/datum/entity_meta/mc_record | ||
entity_type = /datum/entity/mc_record | ||
table_name = "mc_record" | ||
field_typepaths = list( | ||
"round_time"=DB_FIELDTYPE_BIGINT, | ||
"round_id"=DB_FIELDTYPE_BIGINT, | ||
"controller_id"=DB_FIELDTYPE_BIGINT, | ||
"time_taken"=DB_FIELDTYPE_INT, | ||
) | ||
DEFINE_ENTITY(mc_record, "mc_record") | ||
FIELD_BIGINT(mc_record, round_time) | ||
FIELD_BIGINT(mc_record, round_id) | ||
FIELD_BIGINT(mc_record, controller_id) | ||
FIELD_INT(mc_record, time_taken) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,2 @@ | ||
/datum/entity/mc_round | ||
var/map_name | ||
|
||
/datum/entity_meta/mc_round | ||
entity_type = /datum/entity/mc_round | ||
table_name = "mc_round" | ||
field_typepaths = list( | ||
"map_name"=DB_FIELDTYPE_STRING_LARGE, | ||
) | ||
DEFINE_ENTITY(mc_round, "mc_round") | ||
FIELD_STRING_LARGE(mc_round, map_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,7 @@ | ||
/datum/entity/mc_timing_info | ||
var/round_id | ||
var/round_time | ||
var/client_count | ||
var/human_count | ||
var/xeno_count | ||
var/total_time_taken | ||
|
||
/datum/entity_meta/mc_timing_info | ||
entity_type = /datum/entity/mc_timing_info | ||
table_name = "mc_timing_info" | ||
field_typepaths = list( | ||
"round_id"=DB_FIELDTYPE_BIGINT, | ||
"round_time"=DB_FIELDTYPE_INT, | ||
"client_count"=DB_FIELDTYPE_INT, | ||
"human_count"=DB_FIELDTYPE_INT, | ||
"xeno_count"=DB_FIELDTYPE_INT, | ||
"total_time_taken"=DB_FIELDTYPE_BIGINT, | ||
) | ||
DEFINE_ENTITY(mc_timing_info, "mc_timing_info") | ||
FIELD_BIGINT(mc_timing_info, round_id) | ||
FIELD_INT(mc_timing_info, round_time) | ||
FIELD_INT(mc_timing_info, client_count) | ||
FIELD_INT(mc_timing_info, human_count) | ||
FIELD_INT(mc_timing_info, xeno_count) | ||
FIELD_BIGINT(mc_timing_info, total_time_taken) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,34 @@ | ||
/datum/entity/player_job_ban | ||
var/player_id | ||
var/admin_id | ||
var/text | ||
var/date | ||
var/ban_time | ||
var/expiration // in minute format | ||
var/role // role string | ||
|
||
DEFINE_ENTITY(player_job_ban, "player_job_bans") | ||
// TODO: have this automatically handled by the link (weakref) | ||
var/datum/entity/player/player | ||
var/datum/entity/player/admin | ||
FIELD_BIGINT(player_job_ban, player_id) | ||
FIELD_BIGINT(player_job_ban, admin_id) | ||
FIELD_STRING_MAX(player_job_ban, text) | ||
FIELD_STRING_LARGE(player_job_ban, date) | ||
FIELD_INT(player_job_ban, ban_time) | ||
// In minute format | ||
FIELD_BIGINT(player_job_ban, expiration) | ||
// Role string | ||
FIELD_STRING_MEDIUM(player_job_ban, role) | ||
|
||
BSQL_PROTECT_DATUM(/datum/entity/player_job_ban) | ||
|
||
/datum/entity_meta/player_job_ban | ||
entity_type = /datum/entity/player_job_ban | ||
table_name = "player_job_bans" | ||
field_typepaths = list( | ||
"player_id"=DB_FIELDTYPE_BIGINT, | ||
"admin_id"=DB_FIELDTYPE_BIGINT, | ||
"text"=DB_FIELDTYPE_STRING_MAX, | ||
"date"=DB_FIELDTYPE_STRING_LARGE, | ||
"ban_time"=DB_FIELDTYPE_INT, | ||
"expiration"=DB_FIELDTYPE_BIGINT, | ||
"role"=DB_FIELDTYPE_STRING_MEDIUM, | ||
) | ||
|
||
/datum/entity_meta/player_job_ban/on_read(datum/entity/player_job_ban/ban) | ||
if(ban.player_id) | ||
ban.player = DB_ENTITY(/datum/entity/player, ban.player_id) | ||
ban.expiration = text2num("[ban.expiration]") | ||
ban.player = DB_ENTITY(/datum/entity/player, ban.player_id) | ||
ban.expiration = text2num("[ban.expiration]") | ||
|
||
/datum/entity/player_job_ban/proc/load_refs() | ||
if(admin_id) | ||
admin = DB_ENTITY(/datum/entity/player, admin_id) | ||
admin = DB_ENTITY(/datum/entity/player, admin_id) | ||
|
||
/datum/entity_link/player_to_player_job_bans | ||
parent_entity = /datum/entity/player | ||
child_entity = /datum/entity/player_job_ban | ||
child_foreign_key = "player_id" | ||
parent_entity = /datum/entity/player | ||
child_entity = /datum/entity/player_job_ban | ||
child_foreign_key = "player_id" | ||
|
||
/datum/entity_link/admin_to_player_job_bans | ||
parent_entity = /datum/entity/player | ||
child_entity = /datum/entity/player_job_ban | ||
child_foreign_key = "admin_id" | ||
parent_entity = /datum/entity/player | ||
child_entity = /datum/entity/player_job_ban | ||
child_foreign_key = "admin_id" |
Oops, something went wrong.