Empire resources initialisation
* Empire resources will be initialised when an empire is created * When a new resource is created through the appropriate defs.uoc_... function, it will be added to all empires as well.
This commit is contained in:
parent
afc66166e0
commit
37555841ce
7 changed files with 106 additions and 11 deletions
legacyworlds-server-data/db-structure/parts/040-functions
|
@ -102,6 +102,12 @@ BEGIN
|
|||
) VALUES (
|
||||
_name_id , _desc_id , _cat_id , _weight
|
||||
);
|
||||
|
||||
-- Add the resource to all empires
|
||||
INSERT INTO emp.resources ( empire_id , resource_name_id )
|
||||
SELECT name_id , _name_id
|
||||
FROM emp.empires;
|
||||
|
||||
RETURN 'CREATED';
|
||||
EXCEPTION
|
||||
WHEN unique_violation THEN
|
||||
|
@ -312,6 +318,12 @@ BEGIN
|
|||
_difficulty_avg , _difficulty_dev ,
|
||||
_recovery_avg , _recovery_dev
|
||||
);
|
||||
|
||||
-- Add the resource to all empires
|
||||
INSERT INTO emp.resources ( empire_id , resource_name_id )
|
||||
SELECT name_id , _name_id
|
||||
FROM emp.empires;
|
||||
|
||||
RETURN 'CREATED';
|
||||
END IF;
|
||||
|
||||
|
|
|
@ -42,6 +42,10 @@ BEGIN
|
|||
SELECT _name_id , _resource.resource_name_id
|
||||
FROM defs.natural_resources _resource;
|
||||
|
||||
-- Add empire resources
|
||||
INSERT INTO emp.resources ( empire_id , resource_name_id )
|
||||
SELECT _name_id , resource_name_id FROM defs.resources;
|
||||
|
||||
-- Add empire update records
|
||||
FOR _update_type IN SELECT _type
|
||||
FROM unnest( enum_range( NULL::update_type ) ) AS _type
|
||||
|
|
Reference in a new issue